/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package dxfpresentation;

import java.awt.Color;
import java.awt.Frame;
import java.io.File;
import java.math.BigDecimal;
import java.util.*;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
import javax.swing.tree.DefaultMutableTreeNode;
import javax.swing.tree.TreeNode;
import sembr.dao.reader.XmlFileReader;
import sembr.dao.writer.XmlFileWriter;
import sembr.entities.*;
import sembr.geometry.interfacing.DxfDataSetExporter;
import sembr.geometry.interfacing.IDataSet;
import sembr.postprocessing.SembrPostprocessing;
import sembr.processing.SembrProcessing;
import sembr.vtk.animation.Animation;
import sembr.vtk.data.input.*;
import sembr.vtk.mesh.vtkFDTD3DMesher;
import sembr.vtk.reader.*;
import sembr.vtk.visualizing.VtkVisualizationManager;
import uk.co.caprica.vlcj.component.EmbeddedMediaPlayerComponent;
import uk.co.caprica.vlcj.discovery.NativeDiscovery;
import vtk.*;
/**
 *
 * @author adriano
 */
public class MainPresentation extends javax.swing.JFrame {
    /**
     * Creates new form MainPresentation
     * 
     * Constructor for new user's projects
     */
    public MainPresentation(String projectPath) {
                
        initComponents();
        
        // settings for new simulation
        projectSettings = new ProjectSettings();
        projectSettings.setProjectDirectory(projectPath);
        projectSettings.setIsPreprocessing(true);
        
        this.setTitle("SEM-BR @ " + projectSettings.getProjectDirectory());
        this.setExtendedState(MAXIMIZED_BOTH);
        progressBar.setVisible(false);
        lblStatus.setVisible(false);
        lblProcessingStatus.setEnabled(false);
        lblPostProcessingStatus.setEnabled(false);
    }
    
    /**
     * Creates new form MainPresentation
     * 
     * Constructor for user's projects already created
     */
    
    public MainPresentation(ProjectSettings projectSettings) {        
        
        initComponents();
                     
        this.projectSettings = projectSettings;
        this.setTitle("SEM-BR @ " + projectSettings.getProjectDirectory());
        this.setExtendedState(MAXIMIZED_BOTH);
        progressBar.setVisible(false);
        lblStatus.setVisible(false);
                
        if (this.projectSettings.isPostProcessing())
        {
            lblProcessingStatus.setEnabled(true);
            lblPostProcessingStatus.setEnabled(true);
        }
        else
        {
            lblProcessingStatus.setEnabled(false);
            lblPostProcessingStatus.setEnabled(false);
        }        
        
        this.populateGuiFieldsByEntities();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        fileChooser = new javax.swing.JFileChooser();
        tbrMainTools = new javax.swing.JToolBar();
        btnNewProject = new javax.swing.JButton();
        btnOpenProject = new javax.swing.JButton();
        btnSaveProject = new javax.swing.JButton();
        jButton4 = new javax.swing.JButton();
        jButton6 = new javax.swing.JButton();
        jSeparator1 = new javax.swing.JToolBar.Separator();
        jButton7 = new javax.swing.JButton();
        jButton8 = new javax.swing.JButton();
        jSeparator2 = new javax.swing.JToolBar.Separator();
        jButton24 = new javax.swing.JButton();
        btnAddSphere = new javax.swing.JButton();
        btnAddBox = new javax.swing.JButton();
        btnAddCone = new javax.swing.JButton();
        btnAddCylinder = new javax.swing.JButton();
        btnAddCircle = new javax.swing.JButton();
        btnDifferenceOperation = new javax.swing.JButton();
        jSeparator3 = new javax.swing.JToolBar.Separator();
        btnNoCoreCylinder = new javax.swing.JButton();
        jButton3 = new javax.swing.JButton();
        btnConvexCoreCylinder = new javax.swing.JButton();
        btnOptimizedPhotonicCrystal1 = new javax.swing.JButton();
        btnDxfFileImporter = new javax.swing.JButton();
        btnStlReader = new javax.swing.JButton();
        btnOBJReader = new javax.swing.JButton();
        btnVtkReader = new javax.swing.JButton();
        btnVRMLImporter = new javax.swing.JButton();
        btnH5Reader = new javax.swing.JButton();
        jSeparator10 = new javax.swing.JToolBar.Separator();
        jButton32 = new javax.swing.JButton();
        btnAddPostProcessingReport = new javax.swing.JButton();
        btnCreateDomain = new javax.swing.JButton();
        jSeparator4 = new javax.swing.JToolBar.Separator();
        btnFDTDSimulation = new javax.swing.JButton();
        jButton36 = new javax.swing.JButton();
        jSeparator5 = new javax.swing.JToolBar.Separator();
        btnShowField = new javax.swing.JButton();
        btnCuttingPlaneMovie = new javax.swing.JButton();
        btnCutVolume = new javax.swing.JButton();
        btnShowMovie = new javax.swing.JButton();
        jSeparator6 = new javax.swing.JToolBar.Separator();
        btnDelete = new javax.swing.JButton();
        splWholeSplitPane = new javax.swing.JSplitPane();
        splLeftSplitPane = new javax.swing.JSplitPane();
        tbbSetup = new javax.swing.JTabbedPane();
        pnlGraphicObjectProperties = new javax.swing.JPanel();
        jPanel6 = new javax.swing.JPanel();
        txtYfGraficObject = new javax.swing.JTextField();
        txtZiGraficObject = new javax.swing.JTextField();
        txtZfGraficObject = new javax.swing.JTextField();
        txtYiGraficObject = new javax.swing.JTextField();
        txtXfGraficObject = new javax.swing.JTextField();
        txtXiGraficObject = new javax.swing.JTextField();
        lblXiGraficObject = new javax.swing.JLabel();
        lblXfGraficObject = new javax.swing.JLabel();
        lblYiGraficObject = new javax.swing.JLabel();
        lblYfGraficObject = new javax.swing.JLabel();
        lblZiGraficObject = new javax.swing.JLabel();
        lblZfGraficObject = new javax.swing.JLabel();
        jPanel7 = new javax.swing.JPanel();
        jScrollPane2 = new javax.swing.JScrollPane();
        tblMaterials = new javax.swing.JTable();
        chkIsSolid = new javax.swing.JCheckBox();
        pnlSourceProperties = new javax.swing.JPanel();
        jPanel4 = new javax.swing.JPanel();
        lblXSourcePosition = new javax.swing.JLabel();
        lblYSourcePosition = new javax.swing.JLabel();
        lblZSourcePosition = new javax.swing.JLabel();
        txtXSourcePosition = new javax.swing.JTextField();
        txtYSourcePosition = new javax.swing.JTextField();
        txtZSourcePosition = new javax.swing.JTextField();
        jPanel10 = new javax.swing.JPanel();
        lblSourceEndTime = new javax.swing.JLabel();
        txtSourceEndTime = new javax.swing.JTextField();
        lblSouceStartTime = new javax.swing.JLabel();
        txtSourceStartTime = new javax.swing.JTextField();
        lblSourceWidth = new javax.swing.JLabel();
        txtSourceWidth = new javax.swing.JTextField();
        lblSourceFrequency = new javax.swing.JLabel();
        txtFrequencyValue = new javax.swing.JTextField();
        lblSource = new javax.swing.JLabel();
        cmbSourceOption = new javax.swing.JComboBox();
        pnlDomainProperties = new javax.swing.JPanel();
        jPanel5 = new javax.swing.JPanel();
        txtYfComputacionalDomain = new javax.swing.JTextField();
        txtXExtension = new javax.swing.JTextField();
        txtZiComputacionalDomain = new javax.swing.JTextField();
        txtZfComputacionalDomain = new javax.swing.JTextField();
        txtYiComputacionalDomain = new javax.swing.JTextField();
        txtXfComputacionalDomain = new javax.swing.JTextField();
        txtXiComputacionalDomain = new javax.swing.JTextField();
        lblXiComputacionalDomain = new javax.swing.JLabel();
        lblXfComputacionalDomain = new javax.swing.JLabel();
        lblYiComputacionalDomain = new javax.swing.JLabel();
        lblYfComputacionalDomain = new javax.swing.JLabel();
        lblZiComputacionalDomain = new javax.swing.JLabel();
        lblZfComputacionalDomain = new javax.swing.JLabel();
        lblPmlThickness = new javax.swing.JLabel();
        lblXExtension = new javax.swing.JLabel();
        lblYExtension = new javax.swing.JLabel();
        lblZExtension = new javax.swing.JLabel();
        txtPmlTickness = new javax.swing.JTextField();
        txtYExtension = new javax.swing.JTextField();
        txtZExtension = new javax.swing.JTextField();
        jSeparator7 = new javax.swing.JSeparator();
        jSeparator8 = new javax.swing.JSeparator();
        jSeparator9 = new javax.swing.JSeparator();
        lblResolution = new javax.swing.JLabel();
        txtResolution = new javax.swing.JTextField();
        pnlFieldProperties = new javax.swing.JPanel();
        jPanel9 = new javax.swing.JPanel();
        lblZiField = new javax.swing.JLabel();
        txtZiField = new javax.swing.JTextField();
        lblZfField = new javax.swing.JLabel();
        txtZfField = new javax.swing.JTextField();
        txtYiField = new javax.swing.JTextField();
        lblYfField = new javax.swing.JLabel();
        lblYiField = new javax.swing.JLabel();
        txtYfField = new javax.swing.JTextField();
        lblXiField = new javax.swing.JLabel();
        txtXiField = new javax.swing.JTextField();
        lblXfField = new javax.swing.JLabel();
        txtXfField = new javax.swing.JTextField();
        lblFieldDirection = new javax.swing.JLabel();
        cmbFieldDirection = new javax.swing.JComboBox();
        lblFieldType = new javax.swing.JLabel();
        cmbFieldType = new javax.swing.JComboBox();
        scrlPanelManager = new javax.swing.JScrollPane();
        managerTree = new javax.swing.JTree();
        scrlPaneVisualizator = new javax.swing.JScrollPane();
        viewPanel = new javax.swing.JPanel();
        bottomPanel = new javax.swing.JPanel();
        jPanel8 = new javax.swing.JPanel();
        rdVerticalDisplay = new javax.swing.JRadioButton();
        rdWholeDisplay = new javax.swing.JRadioButton();
        rdMultipleDisplay = new javax.swing.JRadioButton();
        rdHorizontalDisplay = new javax.swing.JRadioButton();
        chOutlineBox = new javax.swing.JCheckBox();
        lblPostProcessingStatus = new javax.swing.JLabel();
        lblProcessingStatus = new javax.swing.JLabel();
        lblPreProcessingStatus = new javax.swing.JLabel();
        progressBar = new javax.swing.JProgressBar();
        lblStatus = new javax.swing.JLabel();
        mnbMainMenu = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();
        jMenu2 = new javax.swing.JMenu();
        jMenu3 = new javax.swing.JMenu();
        jMenu4 = new javax.swing.JMenu();
        jMenu5 = new javax.swing.JMenu();
        jMenu6 = new javax.swing.JMenu();

        fileChooser.setApproveButtonText("");
        fileChooser.setCurrentDirectory(null);
        fileChooser.setDialogTitle("");

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

        tbrMainTools.setRollover(true);

        btnNewProject.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dxfpresentation/resources/new.gif"))); // NOI18N
        btnNewProject.setToolTipText("Novo Projeto");
        btnNewProject.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNewProjectActionPerformed(evt);
            }
        });
        tbrMainTools.add(btnNewProject);

        btnOpenProject.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dxfpresentation/resources/openfold.gif"))); // NOI18N
        btnOpenProject.setToolTipText("Abrir Projeto");
        btnOpenProject.setFocusable(false);
        btnOpenProject.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnOpenProject.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnOpenProject.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnOpenProjectActionPerformed(evt);
            }
        });
        tbrMainTools.add(btnOpenProject);

        btnSaveProject.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dxfpresentation/resources/save.gif"))); // NOI18N
        btnSaveProject.setToolTipText("Salvar Projeto");
        btnSaveProject.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        btnSaveProject.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnSaveProject.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnSaveProject.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnSaveProjectActionPerformed(evt);
            }
        });
        tbrMainTools.add(btnSaveProject);

        jButton4.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dxfpresentation/resources/copy.gif"))); // NOI18N
        jButton4.setToolTipText("Copy Project");
        jButton4.setFocusable(false);
        jButton4.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton4.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        tbrMainTools.add(jButton4);

        jButton6.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dxfpresentation/resources/paste.gif"))); // NOI18N
        jButton6.setToolTipText("Paste");
        jButton6.setFocusable(false);
        jButton6.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton6.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        tbrMainTools.add(jButton6);
        tbrMainTools.add(jSeparator1);

        jButton7.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dxfpresentation/resources/undo.gif"))); // NOI18N
        jButton7.setToolTipText("Undo");
        jButton7.setFocusable(false);
        jButton7.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton7.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        tbrMainTools.add(jButton7);

        jButton8.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dxfpresentation/resources/redo.gif"))); // NOI18N
        jButton8.setToolTipText("Redo");
        jButton8.setFocusable(false);
        jButton8.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton8.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        tbrMainTools.add(jButton8);
        tbrMainTools.add(jSeparator2);

        jButton24.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dxfpresentation/resources/addGeometria.gif"))); // NOI18N
        jButton24.setToolTipText("Adicionar Geometria");
        jButton24.setFocusable(false);
        jButton24.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton24.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton24.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton24ActionPerformed(evt);
            }
        });
        tbrMainTools.add(jButton24);

        btnAddSphere.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dxfpresentation/resources/esfera.gif"))); // NOI18N
        btnAddSphere.setToolTipText("Adicionar Esfera");
        btnAddSphere.setFocusable(false);
        btnAddSphere.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnAddSphere.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnAddSphere.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddSphereActionPerformed(evt);
            }
        });
        tbrMainTools.add(btnAddSphere);

        btnAddBox.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dxfpresentation/resources/cubo.gif"))); // NOI18N
        btnAddBox.setToolTipText("Adicionar Cubo");
        btnAddBox.setFocusable(false);
        btnAddBox.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnAddBox.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnAddBox.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddBoxActionPerformed(evt);
            }
        });
        tbrMainTools.add(btnAddBox);

        btnAddCone.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dxfpresentation/resources/cone.gif"))); // NOI18N
        btnAddCone.setToolTipText("Adicionar Cone");
        btnAddCone.setFocusable(false);
        btnAddCone.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnAddCone.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnAddCone.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddConeActionPerformed(evt);
            }
        });
        tbrMainTools.add(btnAddCone);

        btnAddCylinder.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dxfpresentation/resources/cilindro.gif"))); // NOI18N
        btnAddCylinder.setToolTipText("Adicionar Cilindro");
        btnAddCylinder.setFocusable(false);
        btnAddCylinder.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnAddCylinder.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnAddCylinder.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddCylinderActionPerformed(evt);
            }
        });
        tbrMainTools.add(btnAddCylinder);

        btnAddCircle.setText("circle");
        btnAddCircle.setFocusable(false);
        btnAddCircle.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnAddCircle.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnAddCircle.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddCircleActionPerformed(evt);
            }
        });
        tbrMainTools.add(btnAddCircle);

        btnDifferenceOperation.setText("diff");
        btnDifferenceOperation.setFocusable(false);
        btnDifferenceOperation.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnDifferenceOperation.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnDifferenceOperation.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnDifferenceOperationActionPerformed(evt);
            }
        });
        tbrMainTools.add(btnDifferenceOperation);
        tbrMainTools.add(jSeparator3);

        btnNoCoreCylinder.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N
        btnNoCoreCylinder.setText("PCF1");
        btnNoCoreCylinder.setFocusable(false);
        btnNoCoreCylinder.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnNoCoreCylinder.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnNoCoreCylinder.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnNoCoreCylinderActionPerformed(evt);
            }
        });
        tbrMainTools.add(btnNoCoreCylinder);

        jButton3.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N
        jButton3.setText("PCF2");
        jButton3.setFocusable(false);
        jButton3.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton3.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton3.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton3ActionPerformed(evt);
            }
        });
        tbrMainTools.add(jButton3);

        btnConvexCoreCylinder.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N
        btnConvexCoreCylinder.setText("PCF3");
        btnConvexCoreCylinder.setFocusable(false);
        btnConvexCoreCylinder.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnConvexCoreCylinder.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnConvexCoreCylinder.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnConvexCoreCylinderActionPerformed(evt);
            }
        });
        tbrMainTools.add(btnConvexCoreCylinder);

        btnOptimizedPhotonicCrystal1.setFont(new java.awt.Font("Ubuntu", 1, 15)); // NOI18N
        btnOptimizedPhotonicCrystal1.setText("OPC");
        btnOptimizedPhotonicCrystal1.setFocusable(false);
        btnOptimizedPhotonicCrystal1.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnOptimizedPhotonicCrystal1.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnOptimizedPhotonicCrystal1.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnOptimizedPhotonicCrystal1ActionPerformed(evt);
            }
        });
        tbrMainTools.add(btnOptimizedPhotonicCrystal1);

        btnDxfFileImporter.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dxfpresentation/resources/dxf.PNG"))); // NOI18N
        btnDxfFileImporter.setToolTipText("Importar Arquivo DXF");
        btnDxfFileImporter.setFocusable(false);
        btnDxfFileImporter.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnDxfFileImporter.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnDxfFileImporter.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnDxfFileImporterActionPerformed(evt);
            }
        });
        tbrMainTools.add(btnDxfFileImporter);

        btnStlReader.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dxfpresentation/resources/addSTL.gif"))); // NOI18N
        btnStlReader.setToolTipText("Importar Arquivo STL");
        btnStlReader.setFocusable(false);
        btnStlReader.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnStlReader.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnStlReader.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnStlReaderActionPerformed(evt);
            }
        });
        tbrMainTools.add(btnStlReader);

        btnOBJReader.setFont(new java.awt.Font("Bitstream Charter", 1, 14)); // NOI18N
        btnOBJReader.setForeground(new java.awt.Color(213, 10, 81));
        btnOBJReader.setText("OBJ");
        btnOBJReader.setFocusable(false);
        btnOBJReader.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnOBJReader.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnOBJReader.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnOBJReaderActionPerformed(evt);
            }
        });
        tbrMainTools.add(btnOBJReader);

        btnVtkReader.setFont(new java.awt.Font("FreeSans", 1, 14)); // NOI18N
        btnVtkReader.setForeground(javax.swing.UIManager.getDefaults().getColor("CheckBox.foreground"));
        btnVtkReader.setText("VTK");
        btnVtkReader.setFocusable(false);
        btnVtkReader.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnVtkReader.setPreferredSize(new java.awt.Dimension(40, 162));
        btnVtkReader.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnVtkReader.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnVtkReaderActionPerformed(evt);
            }
        });
        tbrMainTools.add(btnVtkReader);

        btnVRMLImporter.setBackground(java.awt.SystemColor.textHighlightText);
        btnVRMLImporter.setFont(new java.awt.Font("Waree", 1, 14)); // NOI18N
        btnVRMLImporter.setForeground(java.awt.Color.gray);
        btnVRMLImporter.setText("VRML");
        btnVRMLImporter.setEnabled(false);
        btnVRMLImporter.setFocusable(false);
        btnVRMLImporter.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnVRMLImporter.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnVRMLImporter.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnVRMLImporterActionPerformed(evt);
            }
        });
        tbrMainTools.add(btnVRMLImporter);

        btnH5Reader.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dxfpresentation/resources/hdf_thumb.png"))); // NOI18N
        btnH5Reader.setFocusable(false);
        btnH5Reader.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnH5Reader.setPreferredSize(new java.awt.Dimension(49, 28));
        btnH5Reader.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnH5Reader.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnH5ReaderActionPerformed(evt);
            }
        });
        tbrMainTools.add(btnH5Reader);
        tbrMainTools.add(jSeparator10);

        jButton32.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dxfpresentation/resources/addFonte.gif"))); // NOI18N
        jButton32.setToolTipText("Adicionar Fonte");
        jButton32.setFocusable(false);
        jButton32.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton32.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        jButton32.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                jButton32ActionPerformed(evt);
            }
        });
        tbrMainTools.add(jButton32);

        btnAddPostProcessingReport.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dxfpresentation/resources/addRelatorios.gif"))); // NOI18N
        btnAddPostProcessingReport.setToolTipText("Adicionar Relatório");
        btnAddPostProcessingReport.setFocusable(false);
        btnAddPostProcessingReport.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnAddPostProcessingReport.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnAddPostProcessingReport.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnAddPostProcessingReportActionPerformed(evt);
            }
        });
        tbrMainTools.add(btnAddPostProcessingReport);

        btnCreateDomain.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dxfpresentation/resources/dominioComputacional.gif"))); // NOI18N
        btnCreateDomain.setToolTipText("Visualizar Domínio Computacional");
        btnCreateDomain.setFocusable(false);
        btnCreateDomain.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnCreateDomain.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnCreateDomain.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCreateDomainActionPerformed(evt);
            }
        });
        tbrMainTools.add(btnCreateDomain);
        tbrMainTools.add(jSeparator4);

        btnFDTDSimulation.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dxfpresentation/resources/simularFDTD3D.gif"))); // NOI18N
        btnFDTDSimulation.setToolTipText("Simular FDTD");
        btnFDTDSimulation.setFocusable(false);
        btnFDTDSimulation.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnFDTDSimulation.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnFDTDSimulation.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnFDTDSimulationActionPerformed(evt);
            }
        });
        tbrMainTools.add(btnFDTDSimulation);

        jButton36.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dxfpresentation/resources/simularFEM.gif"))); // NOI18N
        jButton36.setToolTipText("Simular FEM");
        jButton36.setEnabled(false);
        jButton36.setFocusable(false);
        jButton36.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        jButton36.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        tbrMainTools.add(jButton36);
        tbrMainTools.add(jSeparator5);

        btnShowField.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dxfpresentation/resources/addMalhaPronta.gif"))); // NOI18N
        btnShowField.setToolTipText("Visualizar Cortes Ortogonais");
        btnShowField.setFocusable(false);
        btnShowField.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnShowField.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnShowField.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnShowFieldActionPerformed(evt);
            }
        });
        tbrMainTools.add(btnShowField);

        btnCuttingPlaneMovie.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dxfpresentation/resources/addMalha.gif"))); // NOI18N
        btnCuttingPlaneMovie.setToolTipText("Escolher Plano de Corte");
        btnCuttingPlaneMovie.setFocusable(false);
        btnCuttingPlaneMovie.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnCuttingPlaneMovie.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnCuttingPlaneMovie.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCuttingPlaneMovieActionPerformed(evt);
            }
        });
        tbrMainTools.add(btnCuttingPlaneMovie);

        btnCutVolume.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dxfpresentation/resources/cut.gif"))); // NOI18N
        btnCutVolume.setToolTipText("Efetuar Corte");
        btnCutVolume.setFocusable(false);
        btnCutVolume.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnCutVolume.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnCutVolume.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnCutVolumeActionPerformed(evt);
            }
        });
        tbrMainTools.add(btnCutVolume);

        btnShowMovie.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dxfpresentation/resources/cd.gif"))); // NOI18N
        btnShowMovie.setToolTipText("Filme 2D");
        btnShowMovie.setFocusable(false);
        btnShowMovie.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnShowMovie.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnShowMovie.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnShowMovieActionPerformed(evt);
            }
        });
        tbrMainTools.add(btnShowMovie);
        tbrMainTools.add(jSeparator6);

        btnDelete.setIcon(new javax.swing.ImageIcon(getClass().getResource("/dxfpresentation/resources/delete.gif"))); // NOI18N
        btnDelete.setToolTipText("Deletar");
        btnDelete.setFocusable(false);
        btnDelete.setHorizontalTextPosition(javax.swing.SwingConstants.CENTER);
        btnDelete.setVerticalTextPosition(javax.swing.SwingConstants.BOTTOM);
        btnDelete.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btnDeleteActionPerformed(evt);
            }
        });
        tbrMainTools.add(btnDelete);

        splWholeSplitPane.setMaximumSize(new java.awt.Dimension(3647, 647));
        splWholeSplitPane.setPreferredSize(new java.awt.Dimension(1006, 550));

        splLeftSplitPane.setOrientation(javax.swing.JSplitPane.VERTICAL_SPLIT);
        splLeftSplitPane.setContinuousLayout(true);
        splLeftSplitPane.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        splLeftSplitPane.setMinimumSize(new java.awt.Dimension(250, 250));
        splLeftSplitPane.setPreferredSize(new java.awt.Dimension(250, 500));

        tbbSetup.setAutoscrolls(true);
        tbbSetup.setMaximumSize(new java.awt.Dimension(767, 767));
        tbbSetup.setPreferredSize(new java.awt.Dimension(100, 50));

        pnlGraphicObjectProperties.setPreferredSize(new java.awt.Dimension(257, 400));

        jPanel6.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Limites do Objeto Gráfico", javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Ubuntu", 0, 14))); // NOI18N

        txtYfGraficObject.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtYfGraficObject.setText("0.00");

        txtZiGraficObject.setEditable(false);
        txtZiGraficObject.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtZiGraficObject.setText("0.00");

        txtZfGraficObject.setEditable(false);
        txtZfGraficObject.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtZfGraficObject.setText("0.00");

        txtYiGraficObject.setEditable(false);
        txtYiGraficObject.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtYiGraficObject.setText("0.00");

        txtXfGraficObject.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtXfGraficObject.setText("0.00");

        txtXiGraficObject.setColumns(4);
        txtXiGraficObject.setEditable(false);
        txtXiGraficObject.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtXiGraficObject.setText("0.00");

        lblXiGraficObject.setText("Xi:");

        lblXfGraficObject.setText("Xf:");

        lblYiGraficObject.setText("Yi:");

        lblYfGraficObject.setText("Yf:");

        lblZiGraficObject.setText("Zi:");

        lblZfGraficObject.setText("Zf:");

        javax.swing.GroupLayout jPanel6Layout = new javax.swing.GroupLayout(jPanel6);
        jPanel6.setLayout(jPanel6Layout);
        jPanel6Layout.setHorizontalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addComponent(lblXiGraficObject)
                            .addComponent(lblZiGraficObject))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(jPanel6Layout.createSequentialGroup()
                                .addComponent(txtZiGraficObject)
                                .addGap(18, 18, 18))
                            .addGroup(jPanel6Layout.createSequentialGroup()
                                .addComponent(txtXiGraficObject, javax.swing.GroupLayout.DEFAULT_SIZE, 70, Short.MAX_VALUE)
                                .addGap(18, 18, 18)))
                        .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                            .addGroup(jPanel6Layout.createSequentialGroup()
                                .addComponent(lblXfGraficObject)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtXfGraficObject, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel6Layout.createSequentialGroup()
                                .addComponent(lblZfGraficObject)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtZfGraficObject, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(0, 0, Short.MAX_VALUE))
                    .addGroup(jPanel6Layout.createSequentialGroup()
                        .addComponent(lblYiGraficObject)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtYiGraficObject)
                        .addGap(18, 18, 18)
                        .addComponent(lblYfGraficObject)
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addComponent(txtYfGraficObject, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE))))
        );
        jPanel6Layout.setVerticalGroup(
            jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel6Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtXiGraficObject, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(lblXiGraficObject))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtXfGraficObject, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(lblXfGraficObject)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtYiGraficObject, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(lblYiGraficObject))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(lblYfGraficObject)
                        .addComponent(txtYfGraficObject, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(lblZiGraficObject)
                        .addComponent(txtZiGraficObject, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel6Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(lblZfGraficObject)
                        .addComponent(txtZfGraficObject, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(140, 140, 140))
        );

        jPanel7.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Materiais", javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Ubuntu", 0, 14))); // NOI18N

        tblMaterials.setModel(new javax.swing.table.DefaultTableModel(
            new Object [][] {
                {null, null},
                {null, null},
                {null, null},
                {null, null},
                {null, null}
            },
            new String [] {
                "Tipo", "Dielétrico"
            }
        ) {
            Class[] types = new Class [] {
                java.lang.String.class, java.lang.Double.class
            };

            public Class getColumnClass(int columnIndex) {
                return types [columnIndex];
            }
        });
        jScrollPane2.setViewportView(tblMaterials);

        chkIsSolid.setSelected(true);
        chkIsSolid.setText("Sólido");

        javax.swing.GroupLayout jPanel7Layout = new javax.swing.GroupLayout(jPanel7);
        jPanel7.setLayout(jPanel7Layout);
        jPanel7Layout.setHorizontalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 233, Short.MAX_VALUE)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addComponent(chkIsSolid)
                .addGap(0, 0, Short.MAX_VALUE))
        );
        jPanel7Layout.setVerticalGroup(
            jPanel7Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel7Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(chkIsSolid)
                .addContainerGap())
        );

        javax.swing.GroupLayout pnlGraphicObjectPropertiesLayout = new javax.swing.GroupLayout(pnlGraphicObjectProperties);
        pnlGraphicObjectProperties.setLayout(pnlGraphicObjectPropertiesLayout);
        pnlGraphicObjectPropertiesLayout.setHorizontalGroup(
            pnlGraphicObjectPropertiesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlGraphicObjectPropertiesLayout.createSequentialGroup()
                .addGroup(pnlGraphicObjectPropertiesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jPanel6, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jPanel7, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );
        pnlGraphicObjectPropertiesLayout.setVerticalGroup(
            pnlGraphicObjectPropertiesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlGraphicObjectPropertiesLayout.createSequentialGroup()
                .addGap(18, 18, 18)
                .addComponent(jPanel6, javax.swing.GroupLayout.PREFERRED_SIZE, 132, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(jPanel7, javax.swing.GroupLayout.PREFERRED_SIZE, 186, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        tbbSetup.addTab("Propriedades do Objeto Gráfico", pnlGraphicObjectProperties);

        pnlSourceProperties.setPreferredSize(new java.awt.Dimension(242, 300));

        jPanel4.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createTitledBorder(""), "Posição", javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Ubuntu", 0, 14))); // NOI18N

        lblXSourcePosition.setText("x: ");

        lblYSourcePosition.setText("y:");

        lblZSourcePosition.setText("z:");

        txtXSourcePosition.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtXSourcePosition.setText("0.00");

        txtYSourcePosition.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtYSourcePosition.setText("0.00");

        txtZSourcePosition.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtZSourcePosition.setText("0.00");

        javax.swing.GroupLayout jPanel4Layout = new javax.swing.GroupLayout(jPanel4);
        jPanel4.setLayout(jPanel4Layout);
        jPanel4Layout.setHorizontalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(lblXSourcePosition)
                    .addComponent(lblYSourcePosition)
                    .addComponent(lblZSourcePosition))
                .addGap(18, 18, 18)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(txtYSourcePosition, javax.swing.GroupLayout.DEFAULT_SIZE, 116, Short.MAX_VALUE)
                    .addComponent(txtZSourcePosition)
                    .addComponent(txtXSourcePosition))
                .addGap(33, 33, 33))
        );
        jPanel4Layout.setVerticalGroup(
            jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel4Layout.createSequentialGroup()
                .addGap(5, 5, 5)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblXSourcePosition)
                    .addComponent(txtXSourcePosition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblYSourcePosition)
                    .addComponent(txtYSourcePosition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel4Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblZSourcePosition)
                    .addComponent(txtZSourcePosition, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
        );

        jPanel10.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        lblSourceEndTime.setText("Tempo Final:");

        txtSourceEndTime.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtSourceEndTime.setText("0");

        lblSouceStartTime.setText("Tempo Inicial:");

        txtSourceStartTime.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtSourceStartTime.setText("0");

        lblSourceWidth.setText("Largura:");

        txtSourceWidth.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtSourceWidth.setText("0.00");

        lblSourceFrequency.setText("Frequência:");

        txtFrequencyValue.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtFrequencyValue.setText("0.00");

        lblSource.setText("Fonte:");

        cmbSourceOption.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "--Escolha a fonte", "Gaussiana", "Contínua" }));
        cmbSourceOption.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                cmbSourceOptionActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout jPanel10Layout = new javax.swing.GroupLayout(jPanel10);
        jPanel10.setLayout(jPanel10Layout);
        jPanel10Layout.setHorizontalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel10Layout.createSequentialGroup()
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel10Layout.createSequentialGroup()
                        .addGap(4, 4, 4)
                        .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel10Layout.createSequentialGroup()
                                .addComponent(lblSourceFrequency)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(txtFrequencyValue, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel10Layout.createSequentialGroup()
                                .addComponent(lblSourceWidth)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(txtSourceWidth, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel10Layout.createSequentialGroup()
                                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lblSouceStartTime)
                                    .addComponent(lblSourceEndTime))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 36, Short.MAX_VALUE)
                                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtSourceStartTime, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(txtSourceEndTime, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)))))
                    .addGroup(jPanel10Layout.createSequentialGroup()
                        .addComponent(lblSource)
                        .addGap(18, 18, 18)
                        .addComponent(cmbSourceOption, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))
                .addContainerGap())
        );
        jPanel10Layout.setVerticalGroup(
            jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel10Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cmbSourceOption, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblSource))
                .addGap(18, 18, 18)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtFrequencyValue, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblSourceFrequency))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblSourceWidth)
                    .addComponent(txtSourceWidth, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblSouceStartTime)
                    .addComponent(txtSourceStartTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel10Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblSourceEndTime)
                    .addComponent(txtSourceEndTime, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(23, 23, 23))
        );

        javax.swing.GroupLayout pnlSourcePropertiesLayout = new javax.swing.GroupLayout(pnlSourceProperties);
        pnlSourceProperties.setLayout(pnlSourcePropertiesLayout);
        pnlSourcePropertiesLayout.setHorizontalGroup(
            pnlSourcePropertiesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel4, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
            .addComponent(jPanel10, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        pnlSourcePropertiesLayout.setVerticalGroup(
            pnlSourcePropertiesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlSourcePropertiesLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel10, javax.swing.GroupLayout.PREFERRED_SIZE, 193, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jPanel4, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(16, Short.MAX_VALUE))
        );

        tbbSetup.addTab("Fonte Eletromagnética", pnlSourceProperties);

        jPanel5.setBorder(javax.swing.BorderFactory.createTitledBorder(null, "Limites", javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Ubuntu", 0, 14))); // NOI18N
        jPanel5.setAutoscrolls(true);

        txtYfComputacionalDomain.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtYfComputacionalDomain.setText("0.00");

        txtXExtension.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtXExtension.setText("0.00");

        txtZiComputacionalDomain.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtZiComputacionalDomain.setText("0.00");

        txtZfComputacionalDomain.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtZfComputacionalDomain.setText("0.00");

        txtYiComputacionalDomain.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtYiComputacionalDomain.setText("0.00");

        txtXfComputacionalDomain.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtXfComputacionalDomain.setText("0.00");

        txtXiComputacionalDomain.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtXiComputacionalDomain.setText("0.00");

        lblXiComputacionalDomain.setText("Xi:");

        lblXfComputacionalDomain.setText("Xf:");

        lblYiComputacionalDomain.setText("Yi:");

        lblYfComputacionalDomain.setText("Yf:");

        lblZiComputacionalDomain.setText("Zi:");

        lblZfComputacionalDomain.setText("Zf:");

        lblPmlThickness.setText("Espessura PML:");

        lblXExtension.setText("Extensão em x:");

        lblYExtension.setText("Extensão em y:");

        lblZExtension.setText("Extensão em z:");

        txtPmlTickness.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtPmlTickness.setText("0.00");

        txtYExtension.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtYExtension.setText("0.00");

        txtZExtension.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtZExtension.setText("0.00");

        lblResolution.setText("Resolução:");

        txtResolution.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtResolution.setText("0.00");

        javax.swing.GroupLayout jPanel5Layout = new javax.swing.GroupLayout(jPanel5);
        jPanel5.setLayout(jPanel5Layout);
        jPanel5Layout.setHorizontalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(jSeparator9, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jSeparator7, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(jSeparator8, javax.swing.GroupLayout.Alignment.TRAILING)
                    .addGroup(jPanel5Layout.createSequentialGroup()
                        .addContainerGap()
                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(jPanel5Layout.createSequentialGroup()
                                .addComponent(lblYiComputacionalDomain)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtYiComputacionalDomain)
                                .addGap(18, 18, 18)
                                .addComponent(lblYfComputacionalDomain)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addComponent(txtYfComputacionalDomain, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                                .addComponent(lblXExtension, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(txtXExtension, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createSequentialGroup()
                                .addComponent(lblYExtension, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(txtYExtension, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel5Layout.createSequentialGroup()
                                .addComponent(lblPmlThickness)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(txtPmlTickness, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel5Layout.createSequentialGroup()
                                .addComponent(lblZExtension, javax.swing.GroupLayout.PREFERRED_SIZE, 107, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                .addComponent(txtZExtension, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(jPanel5Layout.createSequentialGroup()
                                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(jPanel5Layout.createSequentialGroup()
                                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addComponent(lblXiComputacionalDomain)
                                            .addComponent(lblZiComputacionalDomain))
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                            .addComponent(txtXiComputacionalDomain)
                                            .addComponent(txtZiComputacionalDomain, javax.swing.GroupLayout.PREFERRED_SIZE, 70, javax.swing.GroupLayout.PREFERRED_SIZE))
                                        .addGap(18, 18, 18)
                                        .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                            .addGroup(jPanel5Layout.createSequentialGroup()
                                                .addComponent(lblXfComputacionalDomain)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(txtXfComputacionalDomain, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE))
                                            .addGroup(jPanel5Layout.createSequentialGroup()
                                                .addComponent(lblZfComputacionalDomain)
                                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                                .addComponent(txtZfComputacionalDomain, javax.swing.GroupLayout.PREFERRED_SIZE, 74, javax.swing.GroupLayout.PREFERRED_SIZE))))
                                    .addGroup(jPanel5Layout.createSequentialGroup()
                                        .addComponent(lblResolution)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                                        .addComponent(txtResolution, javax.swing.GroupLayout.PREFERRED_SIZE, 75, javax.swing.GroupLayout.PREFERRED_SIZE)))
                                .addGap(0, 0, Short.MAX_VALUE)))))
                .addContainerGap())
        );
        jPanel5Layout.setVerticalGroup(
            jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel5Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtXiComputacionalDomain, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(lblXiComputacionalDomain))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtXfComputacionalDomain, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(lblXfComputacionalDomain)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtYiComputacionalDomain, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(lblYiComputacionalDomain))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(lblYfComputacionalDomain)
                        .addComponent(txtYfComputacionalDomain, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(lblZiComputacionalDomain)
                        .addComponent(txtZiComputacionalDomain, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(lblZfComputacionalDomain)
                        .addComponent(txtZfComputacionalDomain, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator7, javax.swing.GroupLayout.PREFERRED_SIZE, 6, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(txtXExtension, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblXExtension))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(txtYExtension, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblYExtension))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                    .addComponent(txtZExtension, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblZExtension))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtResolution, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblResolution))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jSeparator9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addGroup(jPanel5Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblPmlThickness)
                    .addComponent(txtPmlTickness, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
        );

        javax.swing.GroupLayout pnlDomainPropertiesLayout = new javax.swing.GroupLayout(pnlDomainProperties);
        pnlDomainProperties.setLayout(pnlDomainPropertiesLayout);
        pnlDomainPropertiesLayout.setHorizontalGroup(
            pnlDomainPropertiesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel5, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        pnlDomainPropertiesLayout.setVerticalGroup(
            pnlDomainPropertiesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlDomainPropertiesLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel5, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(17, Short.MAX_VALUE))
        );

        tbbSetup.addTab("Domínio Computacional", pnlDomainProperties);

        jPanel9.setBorder(javax.swing.BorderFactory.createTitledBorder(""));

        lblZiField.setText("zi:");

        txtZiField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtZiField.setText("0.00");

        lblZfField.setText("zf:");

        txtZfField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtZfField.setText("0.00");

        txtYiField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtYiField.setText("0.00");

        lblYfField.setText("yf:");

        lblYiField.setText("yi:");

        txtYfField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtYfField.setText("0.00");

        lblXiField.setText("xi:");

        txtXiField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtXiField.setText("0.00");

        lblXfField.setText("xf:");

        txtXfField.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        txtXfField.setText("0.00");

        lblFieldDirection.setText("Eixo:");

        cmbFieldDirection.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "x", "y", "z" }));

        lblFieldType.setText("Corrente:");

        cmbFieldType.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "Elétrico", "Magnético" }));

        javax.swing.GroupLayout jPanel9Layout = new javax.swing.GroupLayout(jPanel9);
        jPanel9.setLayout(jPanel9Layout);
        jPanel9Layout.setHorizontalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel9Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
                        .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblYiField)
                            .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
                                .addGroup(jPanel9Layout.createSequentialGroup()
                                    .addComponent(lblZiField)
                                    .addGap(4, 4, 4)
                                    .addComponent(txtZiField, javax.swing.GroupLayout.DEFAULT_SIZE, 75, Short.MAX_VALUE))
                                .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel9Layout.createSequentialGroup()
                                    .addComponent(lblXiField)
                                    .addGap(3, 3, 3)
                                    .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                        .addComponent(txtXiField, javax.swing.GroupLayout.DEFAULT_SIZE, 75, Short.MAX_VALUE)
                                        .addComponent(txtYiField)))))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                        .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                            .addGroup(jPanel9Layout.createSequentialGroup()
                                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(lblYfField)
                                    .addComponent(lblZfField, javax.swing.GroupLayout.Alignment.TRAILING))
                                .addGap(5, 5, 5)
                                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtYfField)
                                    .addComponent(txtZfField)))
                            .addGroup(jPanel9Layout.createSequentialGroup()
                                .addComponent(lblXfField)
                                .addGap(3, 3, 3)
                                .addComponent(txtXfField, javax.swing.GroupLayout.PREFERRED_SIZE, 80, javax.swing.GroupLayout.PREFERRED_SIZE))))
                    .addGroup(jPanel9Layout.createSequentialGroup()
                        .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(lblFieldDirection)
                            .addComponent(lblFieldType))
                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                        .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(cmbFieldType, 0, 134, Short.MAX_VALUE)
                            .addComponent(cmbFieldDirection, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))
                .addContainerGap())
        );
        jPanel9Layout.setVerticalGroup(
            jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel9Layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cmbFieldType, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblFieldType))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 17, Short.MAX_VALUE)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(cmbFieldDirection, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblFieldDirection))
                .addGap(30, 30, 30)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(txtXiField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblXiField)
                    .addComponent(lblXfField)
                    .addComponent(txtXfField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtYiField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(lblYiField))
                    .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(txtYfField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addComponent(lblYfField)))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addGroup(jPanel9Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(lblZfField)
                    .addComponent(txtZfField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtZiField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(lblZiField))
                .addContainerGap())
        );

        javax.swing.GroupLayout pnlFieldPropertiesLayout = new javax.swing.GroupLayout(pnlFieldProperties);
        pnlFieldProperties.setLayout(pnlFieldPropertiesLayout);
        pnlFieldPropertiesLayout.setHorizontalGroup(
            pnlFieldPropertiesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addComponent(jPanel9, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
        );
        pnlFieldPropertiesLayout.setVerticalGroup(
            pnlFieldPropertiesLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(pnlFieldPropertiesLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(jPanel9, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addContainerGap(114, Short.MAX_VALUE))
        );

        tbbSetup.addTab("Propriedades de Campo", pnlFieldProperties);

        splLeftSplitPane.setRightComponent(tbbSetup);

        javax.swing.tree.DefaultMutableTreeNode treeNode1 = new javax.swing.tree.DefaultMutableTreeNode("Gerenciador");
        javax.swing.tree.DefaultMutableTreeNode treeNode2 = new javax.swing.tree.DefaultMutableTreeNode("Geometrias");
        treeNode1.add(treeNode2);
        treeNode2 = new javax.swing.tree.DefaultMutableTreeNode("Fontes");
        treeNode1.add(treeNode2);
        treeNode2 = new javax.swing.tree.DefaultMutableTreeNode("Relatórios");
        treeNode1.add(treeNode2);
        managerTree.setModel(new javax.swing.tree.DefaultTreeModel(treeNode1));
        scrlPanelManager.setViewportView(managerTree);

        splLeftSplitPane.setLeftComponent(scrlPanelManager);

        splWholeSplitPane.setLeftComponent(splLeftSplitPane);

        scrlPaneVisualizator.setPreferredSize(new java.awt.Dimension(800, 600));

        viewPanel.setBackground(java.awt.Color.white);
        viewPanel.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        viewPanel.setMaximumSize(new java.awt.Dimension(2767, 2767));
        viewPanel.setName("");
        viewPanel.setPreferredSize(new java.awt.Dimension(1092, 589));

        javax.swing.GroupLayout viewPanelLayout = new javax.swing.GroupLayout(viewPanel);
        viewPanel.setLayout(viewPanelLayout);
        viewPanelLayout.setHorizontalGroup(
            viewPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 1162, Short.MAX_VALUE)
        );
        viewPanelLayout.setVerticalGroup(
            viewPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGap(0, 595, Short.MAX_VALUE)
        );

        scrlPaneVisualizator.setViewportView(viewPanel);
        viewPanel.getAccessibleContext().setAccessibleName("");
        viewPanel.getAccessibleContext().setAccessibleDescription("");

        splWholeSplitPane.setRightComponent(scrlPaneVisualizator);

        jPanel8.setBorder(javax.swing.BorderFactory.createTitledBorder(javax.swing.BorderFactory.createTitledBorder(""), "Display", javax.swing.border.TitledBorder.LEFT, javax.swing.border.TitledBorder.TOP, new java.awt.Font("Ubuntu", 0, 14))); // NOI18N

        rdVerticalDisplay.setText("Duplo Vertical");
        rdVerticalDisplay.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rdVerticalDisplayActionPerformed(evt);
            }
        });

        rdWholeDisplay.setSelected(true);
        rdWholeDisplay.setText("Completo");
        rdWholeDisplay.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rdWholeDisplayActionPerformed(evt);
            }
        });

        rdMultipleDisplay.setText("Múltiplo");
        rdMultipleDisplay.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rdMultipleDisplayActionPerformed(evt);
            }
        });

        rdHorizontalDisplay.setText("Duplo Horizontal");
        rdHorizontalDisplay.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                rdHorizontalDisplayActionPerformed(evt);
            }
        });

        chOutlineBox.setText("Domínio Computacional");
        chOutlineBox.setToolTipText("");

        javax.swing.GroupLayout jPanel8Layout = new javax.swing.GroupLayout(jPanel8);
        jPanel8.setLayout(jPanel8Layout);
        jPanel8Layout.setHorizontalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(rdWholeDisplay)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rdVerticalDisplay)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rdHorizontalDisplay)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(rdMultipleDisplay)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(chOutlineBox))
        );
        jPanel8Layout.setVerticalGroup(
            jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(jPanel8Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                .addComponent(rdWholeDisplay)
                .addComponent(rdVerticalDisplay)
                .addComponent(rdHorizontalDisplay)
                .addComponent(rdMultipleDisplay)
                .addComponent(chOutlineBox))
        );

        lblPostProcessingStatus.setText("Pós-Processamento");
        lblPostProcessingStatus.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));
        lblPostProcessingStatus.addMouseListener(new java.awt.event.MouseAdapter() {
            public void mouseClicked(java.awt.event.MouseEvent evt) {
                lblPostProcessingStatusMouseClicked(evt);
            }
        });

        lblProcessingStatus.setHorizontalAlignment(javax.swing.SwingConstants.CENTER);
        lblProcessingStatus.setText("Processamento");
        lblProcessingStatus.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

        lblPreProcessingStatus.setText("Pré-Processamento");
        lblPreProcessingStatus.setBorder(new javax.swing.border.SoftBevelBorder(javax.swing.border.BevelBorder.RAISED));

        progressBar.setBorderPainted(false);
        progressBar.setCursor(new java.awt.Cursor(java.awt.Cursor.DEFAULT_CURSOR));
        progressBar.setString("");

        lblStatus.setText("executando...");

        javax.swing.GroupLayout bottomPanelLayout = new javax.swing.GroupLayout(bottomPanel);
        bottomPanel.setLayout(bottomPanelLayout);
        bottomPanelLayout.setHorizontalGroup(
            bottomPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(bottomPanelLayout.createSequentialGroup()
                .addContainerGap()
                .addComponent(lblPreProcessingStatus)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblProcessingStatus, javax.swing.GroupLayout.PREFERRED_SIZE, 144, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(lblPostProcessingStatus)
                .addGap(18, 18, 18)
                .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, 120, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(6, 6, 6)
                .addComponent(lblStatus)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 35, Short.MAX_VALUE)
                .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
        );
        bottomPanelLayout.setVerticalGroup(
            bottomPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(bottomPanelLayout.createSequentialGroup()
                .addGap(4, 4, 4)
                .addComponent(jPanel8, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(0, 8, Short.MAX_VALUE))
            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, bottomPanelLayout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addGroup(bottomPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                    .addComponent(lblProcessingStatus, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, bottomPanelLayout.createSequentialGroup()
                        .addGroup(bottomPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addComponent(progressBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                            .addComponent(lblStatus))
                        .addGap(3, 3, 3))
                    .addComponent(lblPreProcessingStatus, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(lblPostProcessingStatus, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
                .addContainerGap())
        );

        jMenu1.setText("Arquivo");
        mnbMainMenu.add(jMenu1);

        jMenu2.setText("Editar");
        mnbMainMenu.add(jMenu2);

        jMenu3.setText("Exibir");
        mnbMainMenu.add(jMenu3);

        jMenu4.setText("Simulação");
        mnbMainMenu.add(jMenu4);

        jMenu5.setText("Ferramentas");
        mnbMainMenu.add(jMenu5);

        jMenu6.setText("Ajuda");
        mnbMainMenu.add(jMenu6);

        setJMenuBar(mnbMainMenu);

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(splWholeSplitPane, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(bottomPanel, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addGroup(layout.createSequentialGroup()
                        .addContainerGap()
                        .addComponent(tbrMainTools, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                .addComponent(tbrMainTools, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(18, 18, 18)
                .addComponent(splWholeSplitPane, javax.swing.GroupLayout.PREFERRED_SIZE, 597, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
                .addComponent(bottomPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addGap(76, 76, 76))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    /**
     * @return the projectSettings
     */
    public ProjectSettings getProjectSettings() {
        
        return projectSettings;
    }
    
    // <editor-fold defaultstate="collapsed" desc="Events">   
    
    private void btnDxfFileImporterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDxfFileImporterActionPerformed
        
        String path, fileName;
        fileChooser = new JFileChooser(new File(getSembrPath() + "sembr.dxf.importer/dxf_files"));
        fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
        fileChooser.setDialogTitle("Localizar arquivo DXF");
        
        int returnVal = fileChooser.showOpenDialog(null);
    
        if (returnVal == JFileChooser.APPROVE_OPTION) 
        {           
            String fullFileName = fileChooser.getSelectedFile().getAbsolutePath().toLowerCase();
                       
            if (fullFileName.endsWith(".dxf"))
            {        
                path = fileChooser.getSelectedFile().getAbsolutePath();
                drawDXFFile(path);                   
                setGraphicObjectBounds(objectSourceBase.getPolyData().GetBounds());
                fileName = fileChooser.getSelectedFile().getName();
                List<String> selectedFile = new ArrayList<String>();
                selectedFile.add(fileName);
                addNodesToTree(selectedFile, "Geometrias");  
                managerTree.updateUI();
            }            
        }
    }//GEN-LAST:event_btnDxfFileImporterActionPerformed

    private void rdHorizontalDisplayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdHorizontalDisplayActionPerformed
        
        if (viewPanel != null && visualizationManager != null)
        {
            rdWholeDisplay.setSelected(false);
            rdVerticalDisplay.setSelected(false);
            rdMultipleDisplay.setSelected(false);
            setPanel();
        }
    }//GEN-LAST:event_rdHorizontalDisplayActionPerformed

    private void rdWholeDisplayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdWholeDisplayActionPerformed
        
        if (viewPanel != null && visualizationManager != null)
        {
            rdVerticalDisplay.setSelected(false);
            rdHorizontalDisplay.setSelected(false);
            rdMultipleDisplay.setSelected(false);
            setPanel();
        }
    }//GEN-LAST:event_rdWholeDisplayActionPerformed

    private void rdVerticalDisplayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdVerticalDisplayActionPerformed
        
        if (viewPanel != null && visualizationManager != null)
        {
            rdWholeDisplay.setSelected(false);
            rdHorizontalDisplay.setSelected(false);
            rdMultipleDisplay.setSelected(false);
            setPanel();
        }
    }//GEN-LAST:event_rdVerticalDisplayActionPerformed

    private void rdMultipleDisplayActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_rdMultipleDisplayActionPerformed
        
        if (viewPanel != null && visualizationManager != null)
        {
            rdWholeDisplay.setSelected(false);
            rdVerticalDisplay.setSelected(false);
            rdHorizontalDisplay.setSelected(false);   
            setPanel();
        }
    }//GEN-LAST:event_rdMultipleDisplayActionPerformed

    private void btnFDTDSimulationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnFDTDSimulationActionPerformed
        
        //applyPropertyMaterial();
        testingScalars();
        // update scalar if provided
        // apply scalars on vtkPolyData
        saveCurrentProject();
                
        BackgroundProcessingTask task = new BackgroundProcessingTask();
        task.execute();   
        
        progressBar.setVisible(true);
        progressBar.setIndeterminate(true);
        lblStatus.setVisible(true);
        //lblPreProcessingStatus.setEnabled(true);
        lblProcessingStatus.setEnabled(true);
    }//GEN-LAST:event_btnFDTDSimulationActionPerformed

    private void btnAddCylinderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddCylinderActionPerformed
        // call cylinder's dialog window
        CylinderDialog cylinderDialog = new CylinderDialog(this, true);
        cylinderDialog.setVisible(true);
        // get cylinder set from dialog
        objectSourceBase = cylinderDialog.getCylinder();
        
        // validate if geometry build has been already initialized
        if (geometryBuilder == null) 
            geometryBuilder = new GeometryBuilder();

        // ensures that appender does not add the base geometry
        if (geometryBuilder.getPdCollection().GetNumberOfItems() != 0)
            geometryBuilder.appendPolyData(objectSourceBase.getPolyData());
        else
            geometryBuilder.setBaseGeometry(objectSourceBase.getPolyData());

        geometryBuilder.addPolyData(objectSourceBase.getPolyData());
        
        if (visualizationManager == null)
            visualizationManager = new VtkVisualizationManager(objectSourceBase);
                
        visualizationManager.addPolydata(objectSourceBase.getPolyData());
        visualizationManager.processPipeline(false);
        
        setGraphicObjectBounds(visualizationManager.getAppendedPolyData().GetBounds());
        setObjectForTree(objectSourceBase.getPolyData().GetClassName());
        
        setPanel(); 
    }//GEN-LAST:event_btnAddCylinderActionPerformed

    private void btnVRMLImporterActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnVRMLImporterActionPerformed
        
        String path, fileName;
        fileChooser = new JFileChooser(new File(getSembrPath() + "sembr.dxf.presentation/geometries_samples"));
        fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
        fileChooser.setDialogTitle("Localizar arquivo VRML");
        int returnVal = fileChooser.showOpenDialog(null);
    
        if (returnVal == JFileChooser.APPROVE_OPTION) 
        {           
            String fullFileName = fileChooser.getSelectedFile().getAbsolutePath().toLowerCase();
                       
            if (fullFileName.endsWith(".wrl"))
            {        
                path = fileChooser.getSelectedFile().getAbsolutePath();
                drawVRMLFile(path);                   
                setGraphicObjectBounds(objectReaderBase.getPolyData().GetBounds());                
                fileName = fileChooser.getSelectedFile().getName();
                List<String> selectedFile = new ArrayList<String>();
                selectedFile.add(fileName);
                addNodesToTree(selectedFile, "Geometrias");  
                managerTree.updateUI();               
            }            
        }
    }//GEN-LAST:event_btnVRMLImporterActionPerformed

    private void btnOBJReaderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOBJReaderActionPerformed
        
        String path, fileName;
        fileChooser = new JFileChooser(new File(getSembrPath() + "sembr.dxf.presentation/geometries_samples"));
        fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
        fileChooser.setDialogTitle("Localizar arquivo OBJ");
        
        int returnVal = fileChooser.showOpenDialog(null);
    
        if (returnVal == JFileChooser.APPROVE_OPTION) 
        {           
            String fullFileName = fileChooser.getSelectedFile().getAbsolutePath().toLowerCase();
                       
            if (fullFileName.endsWith(".obj"))
            {        
                path = fileChooser.getSelectedFile().getAbsolutePath();
                drawOBJFile(path);                   
                setGraphicObjectBounds(objectReaderBase.getPolyData().GetBounds());                
                fileName = fileChooser.getSelectedFile().getName();
                List<String> selectedFile = new ArrayList<String>();
                selectedFile.add(fileName);
                addNodesToTree(selectedFile, "Geometrias");  
                managerTree.updateUI();               
            }            
        }
    }//GEN-LAST:event_btnOBJReaderActionPerformed

    private void btnStlReaderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnStlReaderActionPerformed
        
        String path, fileName;
        fileChooser = new JFileChooser(new File(getSembrPath() + "sembr.dxf.presentation/geometries_samples"));
        fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
        fileChooser.setDialogTitle("Localizar arquivo STL");
        
        int returnVal = fileChooser.showOpenDialog(null);
    
        if (returnVal == JFileChooser.APPROVE_OPTION) 
        {           
            String fullFileName = fileChooser.getSelectedFile().getAbsolutePath().toLowerCase();
                       
            if (fullFileName.endsWith(".stl"))
            {        
                path = fileChooser.getSelectedFile().getAbsolutePath();
                drawSTLFile(path);                   
                setGraphicObjectBounds(objectReaderBase.getPolyData().GetBounds());
                fileName = fileChooser.getSelectedFile().getName();
                List<String> selectedFile = new ArrayList<String>();
                selectedFile.add(fileName);
                addNodesToTree(selectedFile, "Geometrias");  
                managerTree.updateUI();              
            }            
        }
    }//GEN-LAST:event_btnStlReaderActionPerformed

    private void btnVtkReaderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnVtkReaderActionPerformed
        
        String path, fileName;
        
        fileChooser = new JFileChooser(new File(getSembrPath() + "sembr.dxf.presentation/geometries_samples"));
        fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
        fileChooser.setDialogTitle("Localizar arquivo VTK");
        
        int returnVal = fileChooser.showOpenDialog(null);
    
        if (returnVal == JFileChooser.APPROVE_OPTION) 
        {           
            String fullFileName = fileChooser.getSelectedFile().getAbsolutePath().toLowerCase();
                       
            if (fullFileName.endsWith(".vtk") || fullFileName.endsWith(".vtp"))
            {        
                path = fileChooser.getSelectedFile().getAbsolutePath();
                drawVTKFile(path);                   
                setGraphicObjectBounds(objectReaderBase.getPolyData().GetBounds());
                fileName = fileChooser.getSelectedFile().getName();
                List<String> selectedFile = new ArrayList<String>();
                selectedFile.add(fileName);
                addNodesToTree(selectedFile, "Geometrias");  
                managerTree.updateUI();              
            }            
        }
    }//GEN-LAST:event_btnVtkReaderActionPerformed

    private void btnAddPostProcessingReportActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddPostProcessingReportActionPerformed
        
        PostProcessingReport postProcessingReport = new PostProcessingReport(this, true);
        postProcessingReport.setField(getFieldFromInput());
        postProcessingReport.setVisible(true);  
        
        if (postProcessingReport.getReports() != null)
        {
            List<String> selectedReports = postProcessingReport.getReports();
            addNodesToTree(selectedReports, "Relatórios");            
            managerTree.updateUI();
        }
    }//GEN-LAST:event_btnAddPostProcessingReportActionPerformed

    private void cmbSourceOptionActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cmbSourceOptionActionPerformed
        
        if (cmbSourceOption.getSelectedIndex() != 0)
        {
            List<String> selectedSource = new ArrayList<String>();
            selectedSource.add(cmbSourceOption.getSelectedItem().toString());
            addNodesToTree(selectedSource, "Fontes");  
            managerTree.updateUI();   
            
            projectSettings.setHasSource(true);
        }
        else
        {
            projectSettings.setHasSource(false);
        }
    }//GEN-LAST:event_cmbSourceOptionActionPerformed

    private void lblPostProcessingStatusMouseClicked(java.awt.event.MouseEvent evt) {//GEN-FIRST:event_lblPostProcessingStatusMouseClicked
        
        lblPreProcessingStatus.setEnabled(false);
        lblProcessingStatus.setEnabled(false);
        lblPostProcessingStatus.setEnabled(true);
        
        PostProcessingConfig postProcessingConfig = new PostProcessingConfig(this, true);
        postProcessingConfig.setPostProcessing(getProjectSettings().getProjectDirectory(), getFieldFromInput().getComponent());
        
        boolean[] isMovieAndFieldPostProcessing = getSelectedPostProcessingReportsFromTree();
        postProcessingConfig.setPostProcessingReport(isMovieAndFieldPostProcessing[0], 
                                                     isMovieAndFieldPostProcessing[1],
                                                     isMovieAndFieldPostProcessing[2]);
       
        // it is not a 2d movie and it is a 3d movie or a field
        //if (isMovieAndFieldPostProcessing[0] &&
        //    (!isMovieAndFieldPostProcessing[1] || isMovieAndFieldPostProcessing[2]))
        //{
            postProcessingConfig.setObjectBoundsInHDF5(getObjectBoundsInHDF5());
           //postProcessingConfig.setVolumeExtention(getExtentionForPostProcessing());
            
            if (isMovieAndFieldPostProcessing[2] && (!isMovieAndFieldPostProcessing[0] && !isMovieAndFieldPostProcessing[1]))
                postProcessingConfig.setSize(postProcessingConfig.getWidth(), 480);
        //}
               
        postProcessingConfig.populateFormFields();
        postProcessingConfig.setVisible(true); // open this jDialog
        
        if (postProcessingConfig.isGeneratingPostProcessing())
        {
            // get axis direction and image file names from post processing and save it 
            // on project settings to use in other program instance  
            getProjectSettings().setAxisDirection(postProcessingConfig.getPostProcessingAxesDirection());
            getProjectSettings().setPostProcessingImageFiles(postProcessingConfig.getImageFileNames());
            getProjectSettings().setFieldRange(postProcessingConfig.getFieldRange());
            new XmlFileWriter(getProjectSettings().getProjectDirectory()).save(projectSettings);
            
            if (postProcessingConfig.getReaderBase() != null)
            {
                objectReaderBase = postProcessingConfig.getReaderBase();
                ((PngReader)objectReaderBase).getPanel().setSize(viewPanel.getWidth(), viewPanel.getHeight());        
                this.viewPanel.removeAll();
                this.viewPanel.add(((PngReader)objectReaderBase).getPanel());
                this.viewPanel.repaint();
            }
            else if (postProcessingConfig.getMovie3D() != null)
            {
                postProcessingConfig.getMovie3D().getPanel().setSize(viewPanel.getWidth(), viewPanel.getHeight());
//                viewPanel.removeAll();
//                viewPanel.add(postProcessingConfig.getMovie3D().getPanel());
//                postProcessingConfig.getMovie3D().getPanel().repaint();
//                viewPanel.repaint();
                // TODO: testing movie 3d in SEMBR GUI, please uncomment code above
                Animation animation = new Animation(postProcessingConfig.getMovie3D());
            }
            else
            {
                if (postProcessingConfig.getMovieName() != null)
                    getProjectSettings().setMovieName(postProcessingConfig.getMovieName());
                else
                    getProjectSettings().setMovieName("movie_name_not_set");
                    
                new XmlFileWriter(getProjectSettings().getProjectDirectory()).save(getProjectSettings());
                show2DVideo(getProjectSettings().getProjectDirectory() + "/post_processing/" + getProjectSettings().getMovieName() + ".mpg");
            }
        }
    }//GEN-LAST:event_lblPostProcessingStatusMouseClicked

    private void btnCuttingPlaneMovieActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCuttingPlaneMovieActionPerformed
        // TODO: change the location of code below. Must be in lblPostProcessingStatusMouseClicked event!
        //       without actor and panel attributes
        // delimit volume from PngReader. Just using depth bounds of volume
        // to facilitate the visualization for cutting
        int[] sortedObjectBoundsForPostProcessing = getSortedObjectBoundsForPostProcessing();
        
        PngReader pngReader = new PngReader(getFieldComponentFromGUI(),
                                            getImageFilesNameAsVtkArray(sortedObjectBoundsForPostProcessing[4], 
                                            sortedObjectBoundsForPostProcessing[5]),
                                            getProjectSettings().getFieldRange(),
                                            true);
        
        PngReader pngReafer = new PngReader(getFieldComponentFromGUI(),
                                            getImageFilesNameAsVtkArray(sortedObjectBoundsForPostProcessing[4], 
                                            sortedObjectBoundsForPostProcessing[5]),
                                            getProjectSettings().getFieldRange(),
                                            true);
        
        this.objectReaderBase = pngReader;
            
        pngReader.getPanel().setSize(viewPanel.getWidth(), viewPanel.getHeight());        
        this.viewPanel.removeAll();
        this.viewPanel.add(pngReader.getPanel());
        this.viewPanel.repaint();      
    }//GEN-LAST:event_btnCuttingPlaneMovieActionPerformed

    private void btnShowFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnShowFieldActionPerformed
                
        objectReaderBase = new PngReader(getFieldComponentFromGUI(), 
                                         getImageFilesNameAsVtkArray(0, 0), 
                                         getProjectSettings().getFieldRange(),
                                         false);    
        
        ((PngReader)objectReaderBase).getPanel().setSize(viewPanel.getWidth(), viewPanel.getHeight());        
        this.viewPanel.removeAll();
        this.viewPanel.add(((PngReader)objectReaderBase).getPanel());
        this.viewPanel.repaint();
    }//GEN-LAST:event_btnShowFieldActionPerformed

    private void btnShowMovieActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnShowMovieActionPerformed
         
        if (this.objectReaderBase != null && this.objectReaderBase instanceof PngReader)
        {
            ((PngReader)objectReaderBase).getPlaneWidget().GetImplicitPlaneRepresentation().UpdatePlacement();
            origin = ((PngReader)objectReaderBase).getPlaneWidget().GetImplicitPlaneRepresentation().GetOrigin();
            normal = ((PngReader)objectReaderBase).getPlaneWidget().GetImplicitPlaneRepresentation().GetNormal();
            
            // TODO: change the location of code below. Must be in lblPostProcessingStatusMouseClicked event!
            // VtkMovie3D movie = new VtkMovie3D(getSembrPath(), "y", 65, 3000, 10, origin, normal);
            //Animation anime = new Animation(movie); 
        }
        else
        {
            String path;
            fileChooser.setCurrentDirectory(new File(getSembrPath() + File.separator + "sembr.dxf.presentation/simulation"));
            int returnVal = fileChooser.showOpenDialog(null);
    
            if (returnVal == JFileChooser.APPROVE_OPTION) 
            {           
                String fullFileName = fileChooser.getSelectedFile().getAbsolutePath().toLowerCase();
                       
                if (fullFileName.endsWith(".mpg") || fullFileName.endsWith(".avi"))
                {        
                   path = fileChooser.getSelectedFile().getAbsolutePath();
                   show2DVideo(path);
                }   
            }           
        }        
    }//GEN-LAST:event_btnShowMovieActionPerformed

    private void btnAddBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddBoxActionPerformed
        // call cube's dialog window
        CubeDialog cubeDialog = new CubeDialog(this, true);
        cubeDialog.setVisible(true); // open dialog
        // get cube set from dialog
        objectSourceBase = new Cube(cubeDialog.getCubeBounds());
        
        // validate if geometry build has been already initialized
        if (geometryBuilder == null) 
            geometryBuilder = new GeometryBuilder();

        // ensures that appender does not add the base geometry
        if (geometryBuilder.getPdCollection().GetNumberOfItems() != 0)
            geometryBuilder.appendPolyData(objectSourceBase.getPolyData());
        else
            geometryBuilder.setBaseGeometry(objectSourceBase.getPolyData());

        geometryBuilder.addPolyData(objectSourceBase.getPolyData());
        
        if (visualizationManager == null)
            visualizationManager = new VtkVisualizationManager(objectSourceBase);
        
        visualizationManager.addPolydata(objectSourceBase.getPolyData());
        visualizationManager.processPipeline(false);
        
        setGraphicObjectBounds(objectSourceBase.getPolyData().GetBounds());
        setObjectForTree(objectSourceBase.getPolyData().GetClassName());
        
        setPanel();   
    }//GEN-LAST:event_btnAddBoxActionPerformed

    private void btnCreateDomainActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCreateDomainActionPerformed
        // create the scenario of complete simulation 
        setWholeDomain();                
    }//GEN-LAST:event_btnCreateDomainActionPerformed

    private void btnSaveProjectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnSaveProjectActionPerformed
        
        if (projectSettings.isSaved())
        {
            int choice = showConfirmMessage("Projeto já salvo. Deseja subscrever?");
        
            if (choice == 0)
            {
                // save project opened by user
                saveCurrentProject();
            }
        }
        else
        {
            // save project opened by user
            saveCurrentProject();
        }        
    }//GEN-LAST:event_btnSaveProjectActionPerformed

    private void btnDeleteActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDeleteActionPerformed
       
        int deleteChoice = showConfirmMessage("Deseja deletar esta simulação?");
        
        if (deleteChoice == 0)
        {
            // clear and delete current simulation
            // source with empty values
            Source source = new Source();
            source.setType("--Escolha a fonte");
            source.setFrequency(0.00);
            source.setWidth(0.00);
            source.setStartTime(0);
            source.setEndTime(0);
            source.setPosition(new double[]{0.00, 0.00, 0.00});

            // computacional domain with empty values
            ComputacionalDomain domain = new ComputacionalDomain();
            domain.setCoordXInitial(0.00);
            domain.setCoordXFinal(0.00);
            domain.setCoordYInitial(0.00);
            domain.setCoordYFinal(0.00);
            domain.setCoordZInitial(0.00);
            domain.setCoordZFinal(0.00);
            domain.setXExtension(0.00);
            domain.setYExtension(0.00);
            domain.setZExtension(0.00);
            domain.setPmlThickness(0.00);
            domain.setResolution(0.00);

            // field with empty values
            Field field = new Field();
            field.setInitialPosition(new double[]{0.00, 0.00, 0.00});
            field.setFinalPosition(new double[]{0.00, 0.00, 0.00});
            field.setFieldType("Elétrico");
            field.setDirection("x");

            // set GUI field with empty values from entities
            setSourceGuiFields(source);
            setComputacionalDomainGuiFields(domain);
            setFieldGuiFields(field);
            setGraphicObjectBounds(new double[]{0.00, 0.00, 0.00, 0.00, 0.00, 0.00});
            
            // clear managerTree
            removeNodesFromTree("Geometrias");
            removeNodesFromTree("Fontes");
            removeNodesFromTree("Relatórios");
            managerTree.updateUI();
            
            // clear material table
            for (int i = 0; i < tblMaterials.getRowCount(); i++)
            {
                tblMaterials.setValueAt(null, i, 0);
                tblMaterials.setValueAt(null, i, 1);
            }
            
            tblMaterials.updateUI();
            
            // clear object graphic
            if (this.objectReaderBase != null)
                this.objectReaderBase = null;
            
            if (this.objectSourceBase != null)
                this.objectSourceBase = null;

            if (visualizationManager != null)
                this.visualizationManager = null;

            // clear panel
            viewPanel.removeAll();
            this.viewPanel.setBackground(Color.WHITE);
            viewPanel.repaint();      
            // clear title project
            this.setTitle("SEM-BR");
            // delete related files and directories
            File file = new File(projectSettings.getProjectDirectory());
            File[] listFiles = file.listFiles();
        
            for (File currentFile : listFiles)
            {
                File[] deeperFiles = currentFile.listFiles();
                
                if (deeperFiles != null)
                {        
                    for (File currentDeeperFiles : deeperFiles)
                    {
                        currentDeeperFiles.delete();
                    }
                }
                
                currentFile.delete();
            }

            file.delete();
        }    
    }//GEN-LAST:event_btnDeleteActionPerformed

    private void btnNewProjectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNewProjectActionPerformed
       
        int showConfirmMessage = showConfirmMessage("Criar um Projeto novo? " +
                                                    "Esta ação subscreverá alterações do projeto anterior. " +
                                                     "Caso queira manter alterações feitas, salve-o antes.");
        
        if (showConfirmMessage == 0) // true
        {
            OpenNewProject newProject = new OpenNewProject(this, true);  
            newProject.setVisible(true);

            if (newProject.getProjectPath() != null)
            {
                clearCurrentProject();
                
                if (projectSettings != null)
                    projectSettings = null;

                // settings for new simulation
                projectSettings = new ProjectSettings();
                projectSettings.setProjectDirectory(newProject.getProjectPath());
                projectSettings.setIsPreprocessing(true);

                this.setTitle("SEM-BR @ " + projectSettings.getProjectDirectory());
                this.setExtendedState(MAXIMIZED_BOTH);
                progressBar.setVisible(false);
                lblStatus.setVisible(false);
                lblProcessingStatus.setEnabled(false);
                lblPostProcessingStatus.setEnabled(false);
            }
        }
    }//GEN-LAST:event_btnNewProjectActionPerformed

    private void btnOpenProjectActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOpenProjectActionPerformed
         
        int showConfirmMessage = showConfirmMessage("Abrir Projeto salvo? " +
                                                    "Esta ação subscreverá alterações do projeto anterior. " +
                                                     "Caso queira manter alterações feitas, salve-o antes.");
        
        if (showConfirmMessage == 0) // true
        {            
            // looking for a project in default path
            fileChooser = new JFileChooser(System.getProperty("user.dir") + File.separator + "simulation");
            fileChooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);
            fileChooser.setDialogTitle("Localizar Projeto");
            int returnVal = fileChooser.showOpenDialog(null);

            if (returnVal == JFileChooser.APPROVE_OPTION) 
            {
                String projectPath = fileChooser.getSelectedFile().toString();            
                List<String> list =  Arrays.asList(new File(projectPath).list());

                if (list.contains("project_settings.xml"))
                {
                    clearCurrentProject(); 
                    
                    if (projectSettings != null)
                        projectSettings = null;

                    // settings for new simulation
                    projectSettings = new XmlFileReader(projectPath).getProjectSettings();
                    projectSettings.setIsSaved(true);  

                    this.setTitle("SEM-BR @ " + projectSettings.getProjectDirectory());
                    this.setExtendedState(MAXIMIZED_BOTH);
                    progressBar.setVisible(false);
                    lblStatus.setVisible(false);
                    lblProcessingStatus.setEnabled(false);
                    lblPostProcessingStatus.setEnabled(false);
                    
                    populateGuiFieldsByEntities();     
                }
                else
                {
                    int choice = showConfirmMessage("Configuração de Projeto não encontrada neste diretório. " + 
                                                    "Deseja utilizá-lo para criar um Projeto novo?");

                    if (choice == 0) // true
                    {
                        clearCurrentProject();
                        // settings for new simulation
                        projectSettings = new ProjectSettings();
                        projectSettings.setProjectDirectory(projectPath);
                        projectSettings.setIsPreprocessing(true);

                        this.setTitle("SEM-BR @ " + projectSettings.getProjectDirectory());
                        this.setExtendedState(MAXIMIZED_BOTH);
                        progressBar.setVisible(false);
                        lblStatus.setVisible(false);
                        lblProcessingStatus.setEnabled(false);
                        lblPostProcessingStatus.setEnabled(false);                        
                    }
                }
            }
        }
    }//GEN-LAST:event_btnOpenProjectActionPerformed

    private void jButton32ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton32ActionPerformed
        // TODO add your handling code here:
    }//GEN-LAST:event_jButton32ActionPerformed

    private void btnOptimizedPhotonicCrystal1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnOptimizedPhotonicCrystal1ActionPerformed
        
        // TODO: it will be improved soon
        // it need to find a way to set and get material in a proper maner
        double pcDieletrics[] = new double[3];
        // looping for getting dieletric from tblMaterials table
        // for this photonic crystal, there are 3 related materials
        for (int i = 0; i < 3; i++)
        {
            if (tblMaterials.getValueAt(i, 1) != null)
                pcDieletrics[i] = ((Double)tblMaterials.getValueAt(i, 1)).doubleValue();
            else
                pcDieletrics[i] = -1.;
        }        
                
        // looking for a backup file because it is a faster way to load this geometry
        objectReaderBase = new VtkGenericReader(getSembrPath() + "sembr.dxf.presentation/geometries_samples/_optimizedCrystal.vtp");
               
        // if optimized crystal is saved, load it
        // else create a new one
        if (objectReaderBase.getPolyData() != null)
        { 
            compositeCube = new OPC();
            compositeCube.setPolyData(objectReaderBase.getPolyData());   
    
        }
        else
        {
            // crystal photonic settings
            // coupler substrate
            compositeCube = new OPC();
             
            compositeCube.setCouplerCenter(-6.2, 0., 0);
            compositeCube.setCouplerDepth(5.930769228);
            compositeCube.setCouplerWidth(4.2);
            compositeCube.setCouplerHeight(0.2);
            compositeCube.setCouplerBounds();
            // columns in coupler
            compositeCube.setLargerRadius(0.15);
            compositeCube.setSmallerRadius(0.1);
            compositeCube.setSpaceBetweenLargerRadius((0.15 * 2) + 0.046153846); 
            compositeCube.setCylinderHeight(compositeCube.getCouplerHeight());
            compositeCube.setCylinderResolution(30);
            // input waveguide
            compositeCube.setInputWaveGuideDepth(2.);
            compositeCube.setInputWaveGuideWidth(6.0 * 0.15);
            compositeCube.setInputWaveGuideBounds();
            // output waveguide
            compositeCube.setOutputWaveGuideDepth(0.2);
            compositeCube.setOutputWaveGuideWidth(6.0 * 0.15);
            compositeCube.setOutputWaveGuideBounds();        

            // set dieletric values of input and output waveguides and coupler
            if (pcDieletrics[0] != -1.)
                compositeCube.setDieletricOfInputWaveGuide(pcDieletrics[0]);
            else
                compositeCube.setDieletricOfInputWaveGuide(1.98);
            
            if (pcDieletrics[1] != -1.)
                compositeCube.setDieletricOfCoupler(pcDieletrics[1]);
            else
                compositeCube.setDieletricOfCoupler(1.45);
            
            if (pcDieletrics[2] != -1.)
                compositeCube.setDieletricOfOutputWaveGuide(pcDieletrics[2]);
            else
                compositeCube.setDieletricOfOutputWaveGuide(3.5);
            
            // construct the photonic device based on prior settings
            compositeCube.buildPhotonicDevice();
        }
        
        objectSourceBase = compositeCube;
        
        if (objectReaderBase.getPolyData() != null)
        {
            setGraphicObjectBounds(objectReaderBase.getPolyData().GetBounds());         
            visualizationManager = new VtkVisualizationManager(objectReaderBase);
            visualizationManager.processPipeline(true); 
            setObjectForTree(objectReaderBase.getPolyData().GetClassName());
        }
        else
        {
            setGraphicObjectBounds(compositeCube.getPolyData().GetBounds());         
            visualizationManager = new VtkVisualizationManager(compositeCube);
            visualizationManager.processPipeline(false); 
            setObjectForTree(compositeCube.getPolyData().GetClassName());
        }
        
        // set table dieletric
        tblMaterials.setValueAt("material_1", 0, 0);
        tblMaterials.setValueAt(compositeCube.getDieletricOfInputWaveGuide(), 0, 1);
        tblMaterials.setValueAt("material_2", 1, 0);
        tblMaterials.setValueAt(compositeCube.getDieletricOfCoupler(), 1, 1);
        tblMaterials.setValueAt("material_3", 2, 0);
        tblMaterials.setValueAt(compositeCube.getDieletricOfOutputWaveGuide(), 2, 1);
                
        setPanel();
    }//GEN-LAST:event_btnOptimizedPhotonicCrystal1ActionPerformed

    private void btnNoCoreCylinderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnNoCoreCylinderActionPerformed
        
        double[] center = {0.00, 0.00, 0.00};
        double[] originOfPlane1 = {0., .5, 0.};
        double[] normalOfPlane1 = {0., -1.5, 0.};
        double[] originOfPlane2 = {0., -0.5, 0.};
        double[] normalOfPlane2 = {0., 1.0, 0.};
                
        objectSourceBase = new PCF1(center, 3.0, originOfPlane1, normalOfPlane1, originOfPlane2, normalOfPlane2);
        setGraphicObjectBounds(objectSourceBase.getPolyData().GetBounds());

        visualizationManager = new VtkVisualizationManager(objectSourceBase);
        visualizationManager.processPipeline(false); 
        setObjectForTree(objectSourceBase.getPolyData().GetClassName());
       
        setPanel();
    }//GEN-LAST:event_btnNoCoreCylinderActionPerformed

    private void btnAddSphereActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddSphereActionPerformed
        
        SphereDialog sphereDialog = new SphereDialog(this, true);
        sphereDialog.setVisible(true); // open dialog
        
        objectSourceBase = new Sphere(sphereDialog.getRadius(), sphereDialog.getCenter());
        
        visualizationManager = new VtkVisualizationManager(objectSourceBase);
        visualizationManager.processPipeline(false);
        
        setGraphicObjectBounds(objectSourceBase.getPolyData().GetBounds());
        setObjectForTree(objectSourceBase.getPolyData().GetClassName());
        
        setPanel(); 
    }//GEN-LAST:event_btnAddSphereActionPerformed

    private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton3ActionPerformed
        
        double[] center = {0.00, 0.00, 0.00};
        objectSourceBase = new PCF2(center, 3.00, 10.00, 100);
        setGraphicObjectBounds(objectSourceBase.getPolyData().GetBounds());
        
        visualizationManager = new VtkVisualizationManager(objectSourceBase);
        visualizationManager.processPipeline(false); 
        setObjectForTree(objectSourceBase.getPolyData().GetClassName());
       
        setPanel();
    }//GEN-LAST:event_jButton3ActionPerformed

    private void btnConvexCoreCylinderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnConvexCoreCylinderActionPerformed
        
        double[] center = {0.00, 0.00, 0.00};
        double[] originOfPlane1 = {0., 2.5, 0.};
        double[] normalOfPlane1 = {0., -1.5, 0.};
        double[] originOfPlane2 = {0., -2.5, 0.};
        double[] normalOfPlane2 = {0., 1.0, 0.};
        
        objectSourceBase = new PCF3(center, 3.0, originOfPlane1, normalOfPlane1, originOfPlane2, normalOfPlane2);
        setGraphicObjectBounds(objectSourceBase.getPolyData().GetBounds());
        
        visualizationManager = new VtkVisualizationManager(objectSourceBase);
        visualizationManager.processPipeline(false); 
        setObjectForTree(objectSourceBase.getPolyData().GetClassName());
        
        setPanel();
    }//GEN-LAST:event_btnConvexCoreCylinderActionPerformed

    private void btnCutVolumeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnCutVolumeActionPerformed
        
        if (this.objectReaderBase != null && this.objectReaderBase instanceof PngReader)
        {
            vtkPanel cutVolume = ((PngReader)objectReaderBase).cutVolume();
            cutVolume.setSize(viewPanel.getWidth(), viewPanel.getHeight());        
            this.viewPanel.removeAll();
            this.viewPanel.add(cutVolume);
            this.viewPanel.repaint();
        }
        
    }//GEN-LAST:event_btnCutVolumeActionPerformed

    private void btnH5ReaderActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnH5ReaderActionPerformed
        // TODO: Testing for HDF5 reading
        String path, fileName;
        fileChooser = new JFileChooser(new File(getSembrPath()));
        fileChooser.setFileSelectionMode(JFileChooser.FILES_ONLY);
        fileChooser.setDialogTitle("Localizar aquivo HDF5");
        
        int returnVal = fileChooser.showOpenDialog(null);
    
        if (returnVal == JFileChooser.APPROVE_OPTION) 
        {           
            String fullFileName = fileChooser.getSelectedFile().getAbsolutePath().toLowerCase();
                       
            if (fullFileName.endsWith(".h5"))
            {        
                path = fileChooser.getSelectedFile().getAbsolutePath();
                drawH5File(path);                   
//                setGraphicObjectBounds(objectSourceBase.getPolyData().GetBounds());
//                fileName = fileChooser.getSelectedFile().getName();
//                List<String> selectedFile = new ArrayList<String>();
//                selectedFile.add(fileName);
//                addNodesToTree(selectedFile, "Geometrias");  
//                managerTree.updateUI();
            }            
        }
        
    }//GEN-LAST:event_btnH5ReaderActionPerformed

    private void jButton24ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButton24ActionPerformed
        // TODO add your handling code here:7
        // testing meshing
        if (objectSourceBase != null)
        {
            vtkFDTD3DMesher mesher = new vtkFDTD3DMesher((VtkDataReceiver)objectSourceBase);
            //mesher.getPanel()
            this.viewPanel.removeAll();
            this.viewPanel.add(mesher.getMultRenderPanel());
            mesher.getMultRenderPanel().repaint();
            this.viewPanel.repaint();
        }
    }//GEN-LAST:event_jButton24ActionPerformed

    private void btnAddConeActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddConeActionPerformed
            // call cone's dialog window
            ConeDialog coneDialog = new ConeDialog(this, true);
            coneDialog.setVisible(true);
            // get cone set from dialog
            objectSourceBase = coneDialog.getCone();
            // validate if geometry build has been already initialized
            if (geometryBuilder == null) 
                geometryBuilder = new GeometryBuilder();
            
            // ensures that appender does not add the base geometry
            if (geometryBuilder.getPdCollection().GetNumberOfItems() != 0)
                geometryBuilder.appendPolyData(objectSourceBase.getPolyData());
            else
                geometryBuilder.setBaseGeometry(objectSourceBase.getPolyData());
        
            geometryBuilder.addPolyData(objectSourceBase.getPolyData());
            
           if (visualizationManager == null)
                visualizationManager = new VtkVisualizationManager(objectSourceBase);
                  
            visualizationManager.addPolydata(objectSourceBase.getPolyData());            
            visualizationManager.processPipeline(false);
        
            setGraphicObjectBounds(visualizationManager.getAppendedPolyData().GetBounds());
            setObjectForTree(objectSourceBase.getPolyData().GetClassName());
        
            setPanel(); 
    }//GEN-LAST:event_btnAddConeActionPerformed

    private void btnDifferenceOperationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnDifferenceOperationActionPerformed
        // apply difference operation over geometries added in pre-processing
        if (geometryBuilder != null) {
            geometryBuilder.applyDifferenceOperation();
            
            if (visualizationManager != null) {
                if (visualizationManager.getAppendedPolyData() != null) 
                    visualizationManager.getAppendedPolyData().Delete();
                
                visualizationManager.setAppendPolydata(new vtkAppendPolyData());
                visualizationManager.addPolydata(geometryBuilder.getPolyData());
                visualizationManager.processPipeline(false);
        
                setGraphicObjectBounds(visualizationManager.getAppendedPolyData().GetBounds());
                setObjectForTree(objectSourceBase.getPolyData().GetClassName());
        
                setPanel(); 
            }
        }
    }//GEN-LAST:event_btnDifferenceOperationActionPerformed

    private void btnAddCircleActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btnAddCircleActionPerformed
        CircleDialog circleDialog = new CircleDialog(this, true);
        circleDialog.setVisible(true);
        
        objectSourceBase = new Circle(circleDialog.getRadius(), circleDialog.getCenter());
        ((Circle)objectSourceBase).setMaterial(circleDialog.getMaterial());
        
        if (geometryBuilder == null) 
            geometryBuilder = new GeometryBuilder();
         
        if (geometryBuilder.getPdCollection().GetNumberOfItems() != 0)
            geometryBuilder.appendPolyData(objectSourceBase.getPolyData());
        else
            geometryBuilder.setBaseGeometry(objectSourceBase.getPolyData());
        
        geometryBuilder.addPolyData(objectSourceBase.getPolyData());
        
        if (visualizationManager == null)
                visualizationManager = new VtkVisualizationManager(objectSourceBase);
                  
            visualizationManager.addPolydata(objectSourceBase.getPolyData());            
            visualizationManager.processPipeline(false);
        
            setGraphicObjectBounds(visualizationManager.getAppendedPolyData().GetBounds());
            setObjectForTree(objectSourceBase.getPolyData().GetClassName());
        
            setPanel(); 
    }//GEN-LAST:event_btnAddCircleActionPerformed
    
    // </editor-fold>
    
    // <editor-fold defaultstate="collapsed" desc="entities related methods">
    
    private void populateGuiFieldsByEntities() {
        
        // setup related data
        XmlFileReader xmlReader = new XmlFileReader(getProjectSettings().getProjectDirectory());
        setSourceGuiFields(xmlReader.getSetup().getSource());
        setComputacionalDomainGuiFields(xmlReader.getSetup().getDomain());
        setFieldGuiFields(xmlReader.getSetup().getField());
        setMaterialTable(xmlReader.getSetup().getDieletrics());
        
        // reports related data
        ArrayList<String> reports = new ArrayList<String>();
        
        if (getProjectSettings().isMovie2D())
            reports.add("Filme 2D");
        
        if (getProjectSettings().isMovie3D())
            reports.add("Filme 3D");
        
        if (getProjectSettings().isFieldAtFixedTime())
            reports.add("Distribuição de Campo em determinado tempo");
        
        addNodesToTree(reports, "Relatórios");
        
        // graphic object related data
        String javaLibPath = System.getProperty("java.library.path");
        objectReaderBase = new VtkGenericReader(getProjectSettings().getProjectDirectory() + "/pre_processing/sembrPolyData.vtp");
        
        if (objectReaderBase.getPolyData() != null)
        {
            setGraphicObjectBounds(objectReaderBase.getPolyData().GetBounds());
            setObjectForTree(objectReaderBase.getPolyData().GetClassName());
        }
        
        setWholeDomain();
    }
    
    private void setSourceGuiFields(Source source) {
        
        cmbSourceOption.setSelectedItem(source.getType());
        txtFrequencyValue.setText(String.valueOf(source.getFrequency()));
        txtSourceWidth.setText(String.valueOf(source.getWidth()));
        txtSourceStartTime.setText(String.valueOf(source.getStartTime()));
        txtSourceEndTime.setText(String.valueOf(source.getEndTime()));
        txtXSourcePosition.setText(String.valueOf(source.getPosition()[0]));
        txtYSourcePosition.setText(String.valueOf(source.getPosition()[1]));
        txtZSourcePosition.setText(String.valueOf(source.getPosition()[2]));
    }
    
    private void setComputacionalDomainGuiFields(ComputacionalDomain domain) {
        
        txtXiComputacionalDomain.setText(String.valueOf(domain.getCoordXInitial()));
        txtXfComputacionalDomain.setText(String.valueOf(domain.getCoordXFinal()));
        txtYiComputacionalDomain.setText(String.valueOf(domain.getCoordYInitial()));
        txtYfComputacionalDomain.setText(String.valueOf(domain.getCoordYFinal()));
        txtZiComputacionalDomain.setText(String.valueOf(domain.getCoordZInitial()));
        txtZfComputacionalDomain.setText(String.valueOf(domain.getCoordZFinal()));
        txtXExtension.setText(String.valueOf(domain.getXExtension()));
        txtYExtension.setText(String.valueOf(domain.getYExtension()));
        txtZExtension.setText(String.valueOf(domain.getZExtension()));
        txtPmlTickness.setText(String.valueOf(domain.getPmlThickness()));
        txtResolution.setText(String.valueOf(domain.getResolution()));
    }
    
    private void setFieldGuiFields(Field field) {
        
        txtXiField.setText(String.valueOf(field.getInitialPosition()[0]));
        txtYiField.setText(String.valueOf(field.getInitialPosition()[1]));    
        txtZiField.setText(String.valueOf(field.getInitialPosition()[2]));
        
        txtXfField.setText(String.valueOf(field.getFinalPosition()[0]));
        txtYfField.setText(String.valueOf(field.getFinalPosition()[1]));
        txtZfField.setText(String.valueOf(field.getFinalPosition()[2]));
        
        cmbFieldType.setSelectedItem(field.getFieldType());
        cmbFieldDirection.setSelectedItem(field.getDirection());
    }
    
    private void setMaterialTable(Map<String, Double> dieletrics)
    {
        Set<String> keySet = dieletrics.keySet();   
        Iterator<String> iterator = keySet.iterator();
        int nrOfDieletrics = keySet.size();
        
        for (int i = (nrOfDieletrics - 1); i > -1; i--)
        {
            String materialName = iterator.next();
            Double dieletricValue = dieletrics.get(materialName);
            
            tblMaterials.setValueAt(materialName, i, 0);
            tblMaterials.setValueAt(dieletricValue, i, 1);
        }                   
    }
    
    private double[] getSourcePostionFromInput() {
        
        double[] sourcePosition = new double[3];
        
        sourcePosition[0] = Double.valueOf(txtXSourcePosition.getText());
        sourcePosition[1] = Double.valueOf(txtYSourcePosition.getText());
        sourcePosition[2] = Double.valueOf(txtZSourcePosition.getText());
        
        return sourcePosition;
    }
     
    private Source getSourceFromInput() {
        
        Source source = new Source();
                
        source.setType(cmbSourceOption.getSelectedItem().toString());
        //source.setName();
        source.setFrequency(Double.valueOf(txtFrequencyValue.getText()));
        source.setWidth(Double.valueOf(txtSourceWidth.getText()));
        source.setStartTime(Integer.valueOf(txtSourceStartTime.getText()));
        source.setEndTime(Integer.valueOf(txtSourceEndTime.getText()));
        source.setPosition(getSourcePostionFromInput());
        
        return source;
    } 
    
    private ComputacionalDomain getComputacionalDomainFromInput() {
        
        ComputacionalDomain domain = new ComputacionalDomain();
        
        domain.setCoordXInitial(Double.valueOf(txtXiComputacionalDomain.getText()));
        domain.setCoordXFinal(Double.valueOf(txtXfComputacionalDomain.getText()));
        domain.setCoordYInitial(Double.valueOf(txtYiComputacionalDomain.getText()));
        domain.setCoordYFinal(Double.valueOf(txtYfComputacionalDomain.getText()));
        domain.setCoordZInitial(Double.valueOf(txtZiComputacionalDomain.getText()));
        domain.setCoordZFinal(Double.valueOf(txtZfComputacionalDomain.getText()));
        domain.setXExtension(Double.valueOf(txtXExtension.getText()));
        domain.setYExtension(Double.valueOf(txtYExtension.getText()));
        domain.setZExtension(Double.valueOf(txtZExtension.getText()));
        domain.setPmlThickness(Double.valueOf(txtPmlTickness.getText()));
        domain.setResolution(Double.valueOf(txtResolution.getText()));
                
        return domain;
    }
    
    private Field getFieldFromInput() {
        
        double[] initialPostion = new double[3];
        initialPostion[0] = Double.valueOf(txtXiField.getText());
        initialPostion[1] = Double.valueOf(txtYiField.getText());
        initialPostion[2] = Double.valueOf(txtZiField.getText());
                
        double[] finalPosition = new double[3];
        finalPosition[0] = Double.valueOf(txtXfField.getText());
        finalPosition[1] = Double.valueOf(txtYfField.getText());
        finalPosition[2] = Double.valueOf(txtZfField.getText());
        
        Field field = new Field();
        
        field.setFieldType(cmbFieldType.getSelectedItem().toString());
        field.setDirection(cmbFieldDirection.getSelectedItem().toString()); 
        field.setInitialPosition(initialPostion);
        field.setFinalPosition(finalPosition);
        
        return field;
    }   
    
    private SimulationSetup getSimulationSetupFromInput() {
       
        // get setup configuration set by user        
        SimulationSetup setup = new SimulationSetup();
        setup.setDomain(getComputacionalDomainFromInput());
        setup.setSource(getSourceFromInput());
        setup.setField(getFieldFromInput());
        setup.setDieletrics(getDieletricsFromInput());  
        
        if (getComputacionalDomainFromInput().getZExtension() == 0)
        {
            setup.setDimension(2); // bidimensional
        }
        else
        {
            setup.setDimension(3); // tridimensional
        }
            
        return setup;
    }
    
    private Map<String, Double> getDieletricsFromInput()
    {
        Map<String, Double> material = new HashMap<String, Double>();
                
        ArrayList<Double> dieletrics = new ArrayList();
        
        for (int i = 0; i < tblMaterials.getRowCount(); i++)
        {
            // column equals 1 for getting dieletric values
            String materialName = "material_";
            Double valueAt = 0.;
                    
            if (tblMaterials.getValueAt(i, 1) != null)
            {
                valueAt = (Double)tblMaterials.getValueAt(i, 1);
                
                if (tblMaterials.getValueAt(i, 0) != null && tblMaterials.getValueAt(i, 0) != "")
                {
                    materialName = (String)tblMaterials.getValueAt(i, 0);
                }
                else
                {
                    materialName = materialName + i;
                }                    
            }
            
            if (valueAt != 0.)
            {
                material.put(materialName, valueAt);
                dieletrics.add(valueAt);
            }
        }
              
        return material;
    }
            
    // </editor-fold>
    
    // <editor-fold defaultstate="collapsed" desc="private methods">
    
    private void drawDXFFile(String filePath) {
        
        IDataSet dataSet = new DxfDataSetExporter(filePath);
        objectSourceBase = new VtkDataReceiver(dataSet);
        visualizationManager = new VtkVisualizationManager(objectSourceBase);
        visualizationManager.processPipeline(true);
        // set Java and Vtk' Panels
        setPanel();        
    }
    
    private void drawVRMLFile(String filePath) {
        
        objectReaderBase = new VrmlReader(filePath);
        visualizationManager = new VtkVisualizationManager(objectReaderBase);
        visualizationManager.processPipeline(true);
        setPanel();
    }
    
    private void drawOBJFile(String filePath) {
        
        objectReaderBase = new ObjReader(filePath);
        visualizationManager = new VtkVisualizationManager(objectReaderBase);
        visualizationManager.processPipeline(true);
        setPanel();
    }
    
    private void drawSTLFile(String filePath) {
        
        objectReaderBase = new StlReader(filePath);
        visualizationManager = new VtkVisualizationManager(objectReaderBase);
        visualizationManager.processPipeline(true);
        setPanel();
    }
    
    private void drawVTKFile(String filePath) {
        
        objectReaderBase = new VtkGenericReader(filePath);
        visualizationManager = new VtkVisualizationManager(objectReaderBase);
        visualizationManager.processPipeline(true);
        setPanel();        
    }
    
    private void drawH5File(String path) {
    
        sembr.postprocessing.SembrPostprocessing postProcessing = new SembrPostprocessing(path);
        postProcessing.setProjectPath(projectSettings.getProjectDirectory());
        postProcessing.generateImagesForField(path, "z.r");
        
        objectReaderBase = new PngReader("Ez", postProcessing.getFileNames(), postProcessing.getFieldRange());  
        ((PngReader)objectReaderBase).getPanel().setSize(viewPanel.getWidth(), viewPanel.getHeight());        
        this.viewPanel.removeAll();
        this.viewPanel.add(((PngReader)objectReaderBase).getPanel());
        this.viewPanel.repaint(); 
    }
        
    private void setPanel() {
        
        this.viewPanel.setBackground(Color.DARK_GRAY);
                
        if (rdWholeDisplay.isSelected())
        {
            this.visualizationManager.getMultRenderPanel().setRenderWindow(true, false, false, false);
        }
        
        else if (rdVerticalDisplay.isSelected())
        {
            this.visualizationManager.getMultRenderPanel().setRenderWindow(true, true, false, false);
        }
        
        else if (rdHorizontalDisplay.isSelected())
        {
            this.visualizationManager.getMultRenderPanel().setRenderWindow(true, false, true, false);       
        }
        
        else
        {
            this.visualizationManager.getMultRenderPanel().setRenderWindow(true, true, true, true);                       
        }
        
        this.visualizationManager.getMultRenderPanel().setSize(viewPanel.getWidth(), viewPanel.getHeight());        
        this.viewPanel.removeAll();
        this.viewPanel.add(this.visualizationManager.getMultRenderPanel());
        this.visualizationManager.getMultRenderPanel().repaint();
        this.viewPanel.repaint();
    }
    
    private void setGraphicObjectBounds(double [] coordinates) {
        
        BigDecimal truncator;

        for (int i = 0; i < coordinates.length; i++)
        {
            //System.out.println(coordinates[i]);
            truncator = new BigDecimal(coordinates[i]);
            truncator = truncator.setScale(4, BigDecimal.ROUND_HALF_EVEN);
            coordinates[i] = truncator.doubleValue();
        } 
           
        txtXiGraficObject.setText(String.valueOf(coordinates[0]));
        txtXfGraficObject.setText(String.valueOf(coordinates[1]));
        txtYiGraficObject.setText(String.valueOf(coordinates[2]));
        txtYfGraficObject.setText(String.valueOf(coordinates[3]));
        txtZiGraficObject.setText(String.valueOf(coordinates[4]));
        txtZfGraficObject.setText(String.valueOf(coordinates[5]));        
    }
    
    public static String getSembrPath() {
        
        String systemPath;
       
        if (System.getProperty("user.dir").endsWith("sembr.dxf.presentation"))
        {
            System.out.println("Diretório do usuário: " + System.getProperty("user.dir"));
            int index = System.getProperty("user.dir").indexOf("sembr.dxf.presentation");
            systemPath = System.getProperty("user.dir").substring(0, index);
            System.out.println("systemPath: " + systemPath);
        }
        else
        { 
            systemPath = System.getProperty("user.dir");
            System.out.println("Diretório da aplicação: " + System.getProperty("user.dir"));
        }
        
        return systemPath;
    }    
        
    private void setObjectForTree(String fileName) {        
        List<String> selectedFile = new ArrayList<String>();
        selectedFile.add(fileName);
        addNodesToTree(selectedFile, "Geometrias");  
        managerTree.updateUI();
    }
        
    private void addNodesToTree(List<String> nodesToAdd, String nodeToBeAdded) {        
        TreeNode root = (TreeNode)managerTree.getModel().getRoot();        
        Enumeration depthFirstChildren = root.children();
        
        while (depthFirstChildren.hasMoreElements())
        {            
            TreeNode currentElement = (TreeNode)depthFirstChildren.nextElement();        
            
            if (nodeToBeAdded.equals(currentElement.toString()))
            {
                if (currentElement.children().hasMoreElements())
                    ((DefaultMutableTreeNode)currentElement).removeAllChildren();
                
                for (String currentNode : nodesToAdd)
                    ((DefaultMutableTreeNode)currentElement).add(new DefaultMutableTreeNode(currentNode)); 
            }
        }               
    }
    
    private void removeNodesFromTree(String nodeToBeRemoved) {
        
        TreeNode root = (TreeNode)managerTree.getModel().getRoot();        
        Enumeration depthFirstChildren = root.children();
        
        while (depthFirstChildren.hasMoreElements())
        {            
            TreeNode currentElement = (TreeNode)depthFirstChildren.nextElement();        
            
            if (nodeToBeRemoved.equals(currentElement.toString()))
            {
                if (currentElement.children().hasMoreElements())
                    ((DefaultMutableTreeNode)currentElement).removeAllChildren();
            }
        }  
    }
    
    private boolean[] getSelectedPostProcessingReportsFromTree() {
        
        // booleans' array to represent what reports are added from user
        // the array has three elements; the first represents 2D movie
        // the second represents 3D movie
        // the third represents the field in a determined time
        boolean[] areReportsAdded = new boolean[3];
        areReportsAdded[0] = false;
        areReportsAdded[1] = false;
        areReportsAdded[2] = false;
        
        TreeNode root = (TreeNode)managerTree.getModel().getRoot(); 
        Enumeration depthFirstChildren = root.children();
        
        while (depthFirstChildren.hasMoreElements())
        {            
            TreeNode currentElement = (TreeNode)depthFirstChildren.nextElement();        
            
            if ((currentElement.toString().equals("Relatórios")))
            {
                Enumeration children = currentElement.children();
                
                while (children.hasMoreElements())
                {
                    TreeNode nextElement = (TreeNode)children.nextElement();
                    
                    if (nextElement.toString().equals("Filme 2D"))
                    {
                        areReportsAdded[0] = true;
                    }
                     
                    else if (nextElement.toString().equals("Filme 3D"))
                    {
                        areReportsAdded[1] = true;
                    }
                    else if (nextElement.toString().equals("Distribuição de Campo em determinado tempo"))
                    {
                        areReportsAdded[2] = true;
                    }
                }               
            }
        }  
        
        return areReportsAdded;
    }
      
    private void show2DVideo(String filePath) {
        
        new NativeDiscovery().discover();              
    
        mediaPlayerComponent = new EmbeddedMediaPlayerComponent();       
             
        JFrame frame = new JFrame("Pós-Processamento - Filme 2D");
        frame.setContentPane(mediaPlayerComponent);
        frame.setLocation(264, 100);
        frame.setSize(1090, 563);
        frame.setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);
        frame.setVisible(true);      
        
        mediaPlayerComponent.getMediaPlayer().playMedia(filePath);
    }
    
    private int[] getObjectBoundsInHDF5() {
        
        int[] boundIndexes = new int[6];
        
        // first and final x's axis indexes
        boundIndexes[0] = getIndexesFromCurrentAxis(Double.valueOf(txtXExtension.getText()) + Double.valueOf(txtPmlTickness.getText()), 
                                                    Double.valueOf(txtXiGraficObject.getText()), 
                                                    Double.valueOf(txtXfGraficObject.getText()))[0];
        boundIndexes[1] = getIndexesFromCurrentAxis(Double.valueOf(txtXExtension.getText()) + Double.valueOf(txtPmlTickness.getText()), 
                                                    Double.valueOf(txtXiGraficObject.getText()), 
                                                    Double.valueOf(txtXfGraficObject.getText()))[1];
        // first and final y's axis indexes
        boundIndexes[2] = getIndexesFromCurrentAxis(Double.valueOf(txtYExtension.getText()) + Double.valueOf(txtPmlTickness.getText()), 
                                                    Double.valueOf(txtYiGraficObject.getText()), 
                                                    Double.valueOf(txtYfGraficObject.getText()))[0];
        boundIndexes[3] = getIndexesFromCurrentAxis(Double.valueOf(txtYExtension.getText()) + Double.valueOf(txtPmlTickness.getText()), 
                                                    Double.valueOf(txtYiGraficObject.getText()), 
                                                    Double.valueOf(txtYfGraficObject.getText()))[1];
        // first and final z's axis indexes
        boundIndexes[4] = getIndexesFromCurrentAxis(Double.valueOf(txtZExtension.getText()) + Double.valueOf(txtPmlTickness.getText()), 
                                                    Double.valueOf(txtZiGraficObject.getText()), 
                                                    Double.valueOf(txtZfGraficObject.getText()))[0];
        boundIndexes[5] = getIndexesFromCurrentAxis(Double.valueOf(txtZExtension.getText()) + Double.valueOf(txtPmlTickness.getText()), 
                                                    Double.valueOf(txtZiGraficObject.getText()), 
                                                    Double.valueOf(txtZfGraficObject.getText()))[1];
        
        return boundIndexes;
    }
    
    private int[] getIndexesFromCurrentAxis(double axisExtension, double firstObjectBound, double finalObjectBound) {
        
        int[] boundIndexes = new int[2];
        double resolution = Double.valueOf(txtResolution.getText());
        
        // first and final axis indexes
        double translatedBounds = axisExtension / 2;
        double distanceFromFirstBound = ((-translatedBounds) - firstObjectBound) * -1;
        double distanceFromFinalBound = translatedBounds - finalObjectBound;
        boundIndexes[0] = (int) Math.round(distanceFromFirstBound * resolution);
        boundIndexes[1] = (int) (Math.round((axisExtension * resolution) - (distanceFromFinalBound * resolution)) -1 );
        
        return boundIndexes;
    }
    
    private vtkAssembly addArtefactsToComputacionalDomain() {
        // TODO: the source lenght must be a factor of geometry dimension
        vtkCubeSource source = new vtkCubeSource();
        source.SetCenter(getSourcePostionFromInput());
        source.SetBounds(getSourcePostionFromInput()[0] - 0.1, 
                         getSourcePostionFromInput()[0] + 0.1, 
                         getSourcePostionFromInput()[1] - 0.1, 
                         getSourcePostionFromInput()[1] + 0.1, 
                         getSourcePostionFromInput()[2] - 0.1, 
                         getSourcePostionFromInput()[2] + 0.1);
        
//        double leftDetectorCenter[] = getFieldFromInput().getInitialPosition();
//        double rightDetectorCenter[] = getFieldFromInput().getFinalPosition();
//        
//        vtkCubeSource leftDetector = new vtkCubeSource();   
//        leftDetector.SetCenter(leftDetectorCenter);
//        
//        vtkCubeSource rightDetector = new vtkCubeSource(); 
//        rightDetector.SetCenter(rightDetectorCenter);
//        
//        double zDistance = rightDetectorCenter[2] - leftDetectorCenter[2];        
//        double artfactWidth = 0.05;
//        double artfactHeight = 0.9;        
//             
//        if (zDistance > 0.)
//        {
//            leftDetector.SetBounds(leftDetectorCenter[0] - artfactHeight, 
//                                   leftDetectorCenter[0] + artfactHeight, 
//                                   leftDetectorCenter[1] - artfactWidth, 
//                                   leftDetectorCenter[1] + artfactWidth, 
//                                   leftDetectorCenter[2] - artfactWidth, 
//                                   leftDetectorCenter[2] + artfactWidth);
//
//            rightDetector.SetBounds(rightDetectorCenter[0] - artfactHeight, 
//                                    rightDetectorCenter[0] + artfactHeight, 
//                                    rightDetectorCenter[1] - artfactWidth, 
//                                    rightDetectorCenter[1] + artfactWidth, 
//                                    rightDetectorCenter[2] - artfactWidth, 
//                                    rightDetectorCenter[2] + artfactWidth);
//        }
//        else
//        {
//            leftDetector.SetBounds(leftDetectorCenter[0] - artfactWidth, 
//                                   leftDetectorCenter[0] + artfactWidth, 
//                                   leftDetectorCenter[1] - artfactWidth, 
//                                   leftDetectorCenter[1] + artfactWidth, 
//                                   leftDetectorCenter[2] - artfactHeight, 
//                                   leftDetectorCenter[2] + artfactHeight);
//
//            rightDetector.SetBounds(rightDetectorCenter[0] - artfactWidth, 
//                                    rightDetectorCenter[0] + artfactWidth, 
//                                    rightDetectorCenter[1] - artfactWidth, 
//                                    rightDetectorCenter[1] + artfactWidth, 
//                                    rightDetectorCenter[2] - artfactHeight, 
//                                    rightDetectorCenter[2] + artfactHeight);
//        }
        
        vtkPolyDataMapper mapper = new vtkPolyDataMapper();
        mapper.SetInput(source.GetOutput());
        
//        vtkPolyDataMapper mapper2 = new vtkPolyDataMapper();
//        mapper2.SetInput(leftDetector.GetOutput());
//        
//        vtkPolyDataMapper mapper3 = new vtkPolyDataMapper();
//        mapper3.SetInput(rightDetector.GetOutput());
            
        vtkActor actor = new vtkActor();
        actor.SetMapper(mapper);
        actor.GetProperty().SetColor(1., 0., 1.);
        actor.GetProperty().SetOpacity(0.8);
        
//        vtkActor actor2 = new vtkActor();
//        actor2.SetMapper(mapper2);
//        actor2.GetProperty().SetColor(1., 1., 1.);
        //actor2.GetProperty().SetOpacity(0.6);
        
//        vtkActor actor3 = new vtkActor();
//        actor3.SetMapper(mapper3);
//        actor3.GetProperty().SetColor(0.9, 0.9, 0.9);
//        actor3.GetProperty().SetOpacity(0.3);
            
        vtkAssembly assembly = new vtkAssembly();
        assembly.AddPart(actor);
//        assembly.AddPart(actor2);
//        assembly.AddPart(actor3);
        
        return assembly;
    }    
    
    private void applyPropertyMaterial() {
        
        double dieletric = 0.;
        
        if (tblMaterials.getValueAt(0, 1) != null)
        {
            dieletric = ((Double)tblMaterials.getValueAt(0, 1)).doubleValue();
        }
        
        if (this.objectReaderBase != null)
        {        
            if (this.objectReaderBase.getPolyData() != null)
            {
                int numberOfCells = this.objectReaderBase.getPolyData().GetNumberOfCells();
                
                vtkDoubleArray atributtes = new vtkDoubleArray();
                atributtes.SetNumberOfValues(numberOfCells);
                atributtes.SetNumberOfComponents(1);
                
                for (int i = 0; i < numberOfCells; i++)
                {
                    atributtes.SetTuple1(i, dieletric);
                }
                
                this.objectReaderBase.getPolyData().GetCellData().SetScalars(atributtes);
                //this.objectReaderBase.getPolyData().GetCellData().GetScalars().Modified();
                this.objectReaderBase.getPolyData().Modified();
            }
        }
        
        if (this.objectSourceBase != null)
        {        
            if (this.objectSourceBase.getPolyData() != null)
            {
                int numberOfCells = this.objectSourceBase.getPolyData().GetNumberOfCells();
                
                vtkDoubleArray atributtes = new vtkDoubleArray();
                atributtes.SetNumberOfValues(numberOfCells);
                atributtes.SetNumberOfComponents(1);
                
                for (int i = 0; i < numberOfCells; i++)
                {
                    atributtes.SetTuple1(i, dieletric);
                }
                
                this.objectSourceBase.getPolyData().GetCellData().SetScalars(atributtes);
                //this.objectReaderBase.getPolyData().GetCellData().GetScalars().Modified();
                this.objectSourceBase.getPolyData().Modified();
            }
        }
        
    }
    
    private void testingScalars() {
        
        if (this.objectSourceBase != null)
        {
            if (this.objectSourceBase.getPolyData() != null)
            {
                vtkCellData cellData = this.objectSourceBase.getPolyData().GetCellData();
                
                if (cellData != null)
                {
                    vtkDataArray scalars = cellData.GetScalars();
                    
                    if (scalars != null)
                    {
                        int numberOfTuples = scalars.GetNumberOfTuples();
                        
                        System.out.println();
                       
                        for (int i = 0; i < numberOfTuples; i++)
                            System.out.println(scalars.GetTuple1(i));
                    }
                }
            }
        }
        
        if (this.objectReaderBase != null)
        {
            if (this.objectReaderBase.getPolyData() != null)
            {
                vtkTriangleFilter triangulator = new vtkTriangleFilter();
                triangulator.SetInput(this.objectReaderBase.getPolyData());
                triangulator.Update();
                
                vtkCellData cellData = this.objectReaderBase.getPolyData().GetCellData();
                String GetArrayName = cellData.GetArrayName(1);
                
                if (cellData != null)
                {
                    vtkDataArray GetArray = cellData.GetScalars("silicio");
                    //int GetSize = GetArray.GetSize();
                    vtkDataArray scalars = cellData.GetScalars();
                    
                    if (scalars != null)
                    {
                        int numberOfTuples = scalars.GetNumberOfTuples();
                        
                        System.out.println();
                       
                        for (int i = 0; i < numberOfTuples; i++)
                            System.out.println(scalars.GetTuple1(i));
                    }
                }
            }
        }
    }
    
    private void setWholeDomain()  {
        
        // computacional domain without pml
        vtkCubeSource cubeDomain = new vtkCubeSource();
        // computacional domain with pml
        vtkCubeSource pmlCubeDomain = new vtkCubeSource();
            
        // source is set
        if (objectSourceBase != null)
        {
            cubeDomain.SetCenter(0., 0., 0.);
            pmlCubeDomain.SetCenter(0., 0., 0.);
            visualizationManager = new VtkVisualizationManager(objectSourceBase);        
        }
        else // reader is set 
        { 
            cubeDomain.SetCenter(0., 0., 0.);
            pmlCubeDomain.SetCenter(0., 0., 0.);
            visualizationManager = new VtkVisualizationManager(objectReaderBase);    
        }    
        
        // cube to represent computacional domain without pml region
        cubeDomain.SetXLength(getComputacionalDomainFromInput().getXExtension());
        cubeDomain.SetYLength(getComputacionalDomainFromInput().getYExtension());
        cubeDomain.SetZLength(getComputacionalDomainFromInput().getZExtension());
        
        // cube to represent computacional domain with pml
        pmlCubeDomain.SetXLength(getComputacionalDomainFromInput().getXExtension() + getComputacionalDomainFromInput().getPmlThickness());
        pmlCubeDomain.SetYLength(getComputacionalDomainFromInput().getYExtension() + getComputacionalDomainFromInput().getPmlThickness()); 
        // set pmlCubeDomain z's axes only for 3D simulation
        if (getComputacionalDomainFromInput().getZExtension() != 0.) 
        {
            pmlCubeDomain.SetZLength(getComputacionalDomainFromInput().getZExtension() + getComputacionalDomainFromInput().getPmlThickness());
        }
        else
        {
            pmlCubeDomain.SetZLength(0.);
        }
        
        pmlCubeDomain.Update();
        
        if (visualizationManager != null)
        {
            // visualization of computacional domain settings
            visualizationManager.setOutlineDomain(cubeDomain.GetOutput());
            visualizationManager.setPmlDomainActor(pmlCubeDomain.GetOutput().GetBounds());
            visualizationManager.processPipeline(false);            

            // source and field detector actors to be added on visualization
            if (projectSettings.hasSource())
            {
                vtkAssembly artefacts = addArtefactsToComputacionalDomain();
                visualizationManager.addActorToPanel(artefacts);
            }

            setPanel();
        }
    }
    
    private void saveCurrentProject() 
    {        
        // get setup configuration set by user        
        SimulationSetup setup = getSimulationSetupFromInput();       
        
        // source base is set
        if (objectSourceBase != null)
        {            
            setup.setObjectBounds(objectSourceBase.getPolyData().GetBounds());
            objectSourceBase.saveXmlFormat(getProjectSettings().getProjectDirectory() + 
                                           File.separator +
                                           "pre_processing" +
                                           File.separator +
                                           "sembrPolyData");
        }
        else if (objectReaderBase != null) // reader base is set
        {
            setup.setObjectBounds(objectReaderBase.getPolyData().GetBounds());
            objectReaderBase.saveXmlFormat(getProjectSettings().getProjectDirectory() + 
                                           File.separator +   
                                           "pre_processing" +
                                           File.separator +
                                           "sembrPolyData");
        }
        
        // define if user chooses movie in simulation
        boolean[] selectedPostProcessingReportsFromTree = getSelectedPostProcessingReportsFromTree();        
        getProjectSettings().setIsMovie2D(selectedPostProcessingReportsFromTree[0] || selectedPostProcessingReportsFromTree[1]);
        getProjectSettings().setIsFieldAtFixedTime(selectedPostProcessingReportsFromTree[2]);
        
        XmlFileWriter xmlWriter = new XmlFileWriter(getProjectSettings().getProjectDirectory());
        xmlWriter.save(setup);
        xmlWriter.save(getProjectSettings());
    }
    
    private void clearCurrentProject() {
        
        // clear and delete current simulation
            // source with empty values
            Source source = new Source();
            source.setType("--Escolha a fonte");
            source.setFrequency(0.00);
            source.setWidth(0.00);
            source.setStartTime(0);
            source.setEndTime(0);
            source.setPosition(new double[]{0.00, 0.00, 0.00});

            // computacional domain with empty values
            ComputacionalDomain domain = new ComputacionalDomain();
            domain.setCoordXInitial(0.00);
            domain.setCoordXFinal(0.00);
            domain.setCoordYInitial(0.00);
            domain.setCoordYFinal(0.00);
            domain.setCoordZInitial(0.00);
            domain.setCoordZFinal(0.00);
            domain.setXExtension(0.00);
            domain.setYExtension(0.00);
            domain.setZExtension(0.00);
            domain.setPmlThickness(0.00);
            domain.setResolution(0.00);

            // field with empty values
            Field field = new Field();
            field.setInitialPosition(new double[]{0.00, 0.00, 0.00});
            field.setFinalPosition(new double[]{0.00, 0.00, 0.00});
            field.setFieldType("Elétrico");
            field.setDirection("x");

            // set GUI field with empty values from entities
            setSourceGuiFields(source);
            setComputacionalDomainGuiFields(domain);
            setFieldGuiFields(field);
            setGraphicObjectBounds(new double[]{0.00, 0.00, 0.00, 0.00, 0.00, 0.00});
            
            // clear managerTree
            removeNodesFromTree("Geometrias");
            removeNodesFromTree("Fontes");
            removeNodesFromTree("Relatórios");
            managerTree.updateUI();
            
            // clear material table
            for (int i = 0; i < tblMaterials.getRowCount(); i++)
            {
                tblMaterials.setValueAt(null, i, 0);
                tblMaterials.setValueAt(null, i, 1);
            }
            
            tblMaterials.updateUI();
            
            // clear object graphic
            if (objectReaderBase != null)
                objectReaderBase = null;
            else
                objectSourceBase = null;

            if (visualizationManager != null)
                visualizationManager = null;
            
            if (geometryBuilder != null)
                geometryBuilder = null;

            // clear panel
            viewPanel.removeAll();
            this.viewPanel.setBackground(Color.WHITE);
            viewPanel.repaint();      
            // clear title project
            this.setTitle("SEM-BR");
    }
    
    private int showConfirmMessage(String message) {
            
        return JOptionPane.showConfirmDialog(new Frame(), message, "Mensagem de Confirmação", JOptionPane.YES_NO_OPTION);
    }
    
    private int[] splitSimulationDimension(String properties) {
        
        if (properties == null) return null;
        
        String delimiter = " ";
        String[] slicedProperties;
        ArrayList<String> simulationProperties = new ArrayList<String>();
        
        slicedProperties = properties.split(delimiter);
        // add sub-string related with field
        simulationProperties.add(slicedProperties[0]);             
        
        // begining of 'Dataset' sub-string
        int i = 23;
        
        while (i <= (slicedProperties.length - 1))
        {
            simulationProperties.add(slicedProperties[i]);
            i++;
        }
        
        int xLength, yLength, zLength, timeLength;
        String x, y, z, time;
        
        int lastIndex = simulationProperties.size() - 1;
          
        switch (simulationProperties.size())
        {
            case 5: // bidimensional
                xLength = simulationProperties.get(lastIndex - 2).length();
                yLength = simulationProperties.get(lastIndex - 1).length();
                timeLength = simulationProperties.get(lastIndex).length();
        
                x = simulationProperties.get(lastIndex - 2).substring(1, xLength - 1);
                y = simulationProperties.get(lastIndex - 1).substring(0, yLength - 1);
                z = "0";
                time = simulationProperties.get(lastIndex).substring(0, timeLength - 5);
                break;
                
            case 6: // tridimensional
                xLength = simulationProperties.get(lastIndex - 3).length();
                yLength = simulationProperties.get(lastIndex - 2).length();
                zLength = simulationProperties.get(lastIndex - 1).length();
                timeLength = simulationProperties.get(lastIndex).length();
        
                x = simulationProperties.get(lastIndex - 3).substring(1, xLength - 1);
                y = simulationProperties.get(lastIndex - 2).substring(0, yLength - 1);
                z = simulationProperties.get(lastIndex - 1).substring(0, zLength - 1);
                time = simulationProperties.get(lastIndex).substring(0, timeLength - 5);    
                break;
            
            default:
                x = y = z = time = "0";
        }
        
        int dimensions[] = new int[4];
        dimensions[0] = Integer.valueOf(x);
        dimensions[1] = Integer.valueOf(y); 
        dimensions[2] = Integer.valueOf(z);
        dimensions[3] = Integer.valueOf(time);
        
        return dimensions;
    }
    
    private String getFieldComponentFromGUI() {
        
        String fieldType;
        
        if ("Elétrico".equals(cmbFieldType.getSelectedItem().toString()))
            fieldType = "E";
        else
            fieldType = "H";
        
        return fieldType + cmbFieldDirection.getSelectedItem().toString();
    }
    
    private int[] getExtentionForPostProcessing() {
        
        // considering that user DID NOT MODIFIED field type and direction choosed in simulation     
        String fieldComponent = getFieldComponentFromGUI();
        
        String simulationDimension = new sembr.postprocessing.SembrPostprocessing(getProjectSettings().getProjectDirectory(), 
                                                                                  fieldComponent).getSimulationDimension();
        
        int[] splitedSimulationDimension = splitSimulationDimension(simulationDimension);
               
        int[] bound = new int[6];
        
        if ("x".equals(getProjectSettings().getAxisDirection()))
        {
            // cut in yz plane
            // width
            bound[0] = 0;
            bound[1] = splitedSimulationDimension[1];
            // height
            bound[2] = 0;
            bound[3] = splitedSimulationDimension[2];
            // depth
            bound[4] = 0;
            bound[5] = splitedSimulationDimension[0];  
        }
        else if ("y".equals(getProjectSettings().getAxisDirection()))
        {
            // cut in yz plane
            // width
            bound[0] = 0;
            bound[1] = splitedSimulationDimension[0];
            // height
            bound[2] = 0;
            bound[3] = splitedSimulationDimension[2];
            // depth
            bound[4] = 0;
            bound[5] = splitedSimulationDimension[1];
        }
        else
        {
            // cut in xy plane
            // width
            bound[0] = 0;
            bound[1] = splitedSimulationDimension[0];
            // height
            bound[2] = 0;
            bound[3] = splitedSimulationDimension[1];
            // depth
            bound[4] = 0;
            bound[5] = splitedSimulationDimension[2];   
        }
        
        return bound;
    }
    
    private int[] getSortedObjectBoundsForPostProcessing() {
        
        int[] currentObjectBoundsInH5 = getObjectBoundsInHDF5();
        
        int[] bounds = new int[6];
        
        if ("x".equals(getProjectSettings().getAxisDirection()))
        {
            // cut in yz plane
            // width
            bounds[0] = currentObjectBoundsInH5[2];
            bounds[1] = currentObjectBoundsInH5[3];
            // height
            bounds[2] = currentObjectBoundsInH5[4];
            bounds[3] = currentObjectBoundsInH5[5];
            // depth
            bounds[4] = currentObjectBoundsInH5[0];
            bounds[5] = currentObjectBoundsInH5[1];  
        }
        else if ("y".equals(getProjectSettings().getAxisDirection()))
        {
            // cut in xz plane
            // width
            bounds[0] = currentObjectBoundsInH5[0];
            bounds[1] = currentObjectBoundsInH5[1];
            // height
            bounds[2] = currentObjectBoundsInH5[4];
            bounds[3] = currentObjectBoundsInH5[5];
            // depth
            bounds[4] = currentObjectBoundsInH5[2];
            bounds[5] = currentObjectBoundsInH5[3];
        }
        else
        {
            // cut in xy plane
            // width
            bounds[0] = currentObjectBoundsInH5[0];
            bounds[1] = currentObjectBoundsInH5[1];
            // height
            bounds[2] = currentObjectBoundsInH5[2];
            bounds[3] = currentObjectBoundsInH5[3];
            // depth
            bounds[4] = currentObjectBoundsInH5[4];
            bounds[5] = currentObjectBoundsInH5[5];   
        }
        
        return bounds;
    }            
    
    private vtkStringArray getImageFilesNameAsVtkArray(int initialDelimiter, int finalDelimiter) {
        
        ArrayList<String> javaFileName = getProjectSettings().getPostProcessingImageFiles();
        
        vtkStringArray vtkFileNames = new vtkStringArray();
        int size = javaFileName.size();
        int lenght;
        
        if (finalDelimiter == 0)
            lenght = size - 1;
        else
            lenght = finalDelimiter;
        
        for (int i = initialDelimiter; i <= lenght; i++)
        {
            vtkFileNames.InsertNextValue(javaFileName.get(i));
        }
                
        return vtkFileNames;
    }
    
    // </editor-fold>
      
    // <editor-fold defaultstate="collapsed" desc="attributes">
    private sembr.vtk.reader.ReaderBase objectReaderBase;
    private sembr.vtk.data.input.SourceBase objectSourceBase;
    private OPC compositeCube;
    private VtkVisualizationManager visualizationManager;
    private EmbeddedMediaPlayerComponent mediaPlayerComponent;
    private ProjectSettings projectSettings;
    private double[] origin = null;
    private double[] normal = null;
    private GeometryBuilder geometryBuilder = null;
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JPanel bottomPanel;
    private javax.swing.JButton btnAddBox;
    private javax.swing.JButton btnAddCircle;
    private javax.swing.JButton btnAddCone;
    private javax.swing.JButton btnAddCylinder;
    private javax.swing.JButton btnAddPostProcessingReport;
    private javax.swing.JButton btnAddSphere;
    private javax.swing.JButton btnConvexCoreCylinder;
    private javax.swing.JButton btnCreateDomain;
    private javax.swing.JButton btnCutVolume;
    private javax.swing.JButton btnCuttingPlaneMovie;
    private javax.swing.JButton btnDelete;
    private javax.swing.JButton btnDifferenceOperation;
    private javax.swing.JButton btnDxfFileImporter;
    private javax.swing.JButton btnFDTDSimulation;
    private javax.swing.JButton btnH5Reader;
    private javax.swing.JButton btnNewProject;
    private javax.swing.JButton btnNoCoreCylinder;
    private javax.swing.JButton btnOBJReader;
    private javax.swing.JButton btnOpenProject;
    private javax.swing.JButton btnOptimizedPhotonicCrystal1;
    private javax.swing.JButton btnSaveProject;
    private javax.swing.JButton btnShowField;
    private javax.swing.JButton btnShowMovie;
    private javax.swing.JButton btnStlReader;
    private javax.swing.JButton btnVRMLImporter;
    private javax.swing.JButton btnVtkReader;
    private javax.swing.JCheckBox chOutlineBox;
    private javax.swing.JCheckBox chkIsSolid;
    private javax.swing.JComboBox cmbFieldDirection;
    private javax.swing.JComboBox cmbFieldType;
    private javax.swing.JComboBox cmbSourceOption;
    private javax.swing.JFileChooser fileChooser;
    private javax.swing.JButton jButton24;
    private javax.swing.JButton jButton3;
    private javax.swing.JButton jButton32;
    private javax.swing.JButton jButton36;
    private javax.swing.JButton jButton4;
    private javax.swing.JButton jButton6;
    private javax.swing.JButton jButton7;
    private javax.swing.JButton jButton8;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenu jMenu2;
    private javax.swing.JMenu jMenu3;
    private javax.swing.JMenu jMenu4;
    private javax.swing.JMenu jMenu5;
    private javax.swing.JMenu jMenu6;
    private javax.swing.JPanel jPanel10;
    private javax.swing.JPanel jPanel4;
    private javax.swing.JPanel jPanel5;
    private javax.swing.JPanel jPanel6;
    private javax.swing.JPanel jPanel7;
    private javax.swing.JPanel jPanel8;
    private javax.swing.JPanel jPanel9;
    private javax.swing.JScrollPane jScrollPane2;
    private javax.swing.JToolBar.Separator jSeparator1;
    private javax.swing.JToolBar.Separator jSeparator10;
    private javax.swing.JToolBar.Separator jSeparator2;
    private javax.swing.JToolBar.Separator jSeparator3;
    private javax.swing.JToolBar.Separator jSeparator4;
    private javax.swing.JToolBar.Separator jSeparator5;
    private javax.swing.JToolBar.Separator jSeparator6;
    private javax.swing.JSeparator jSeparator7;
    private javax.swing.JSeparator jSeparator8;
    private javax.swing.JSeparator jSeparator9;
    private javax.swing.JLabel lblFieldDirection;
    private javax.swing.JLabel lblFieldType;
    private javax.swing.JLabel lblPmlThickness;
    private javax.swing.JLabel lblPostProcessingStatus;
    private javax.swing.JLabel lblPreProcessingStatus;
    private javax.swing.JLabel lblProcessingStatus;
    private javax.swing.JLabel lblResolution;
    private javax.swing.JLabel lblSouceStartTime;
    private javax.swing.JLabel lblSource;
    private javax.swing.JLabel lblSourceEndTime;
    private javax.swing.JLabel lblSourceFrequency;
    private javax.swing.JLabel lblSourceWidth;
    private javax.swing.JLabel lblStatus;
    private javax.swing.JLabel lblXExtension;
    private javax.swing.JLabel lblXSourcePosition;
    private javax.swing.JLabel lblXfComputacionalDomain;
    private javax.swing.JLabel lblXfField;
    private javax.swing.JLabel lblXfGraficObject;
    private javax.swing.JLabel lblXiComputacionalDomain;
    private javax.swing.JLabel lblXiField;
    private javax.swing.JLabel lblXiGraficObject;
    private javax.swing.JLabel lblYExtension;
    private javax.swing.JLabel lblYSourcePosition;
    private javax.swing.JLabel lblYfComputacionalDomain;
    private javax.swing.JLabel lblYfField;
    private javax.swing.JLabel lblYfGraficObject;
    private javax.swing.JLabel lblYiComputacionalDomain;
    private javax.swing.JLabel lblYiField;
    private javax.swing.JLabel lblYiGraficObject;
    private javax.swing.JLabel lblZExtension;
    private javax.swing.JLabel lblZSourcePosition;
    private javax.swing.JLabel lblZfComputacionalDomain;
    private javax.swing.JLabel lblZfField;
    private javax.swing.JLabel lblZfGraficObject;
    private javax.swing.JLabel lblZiComputacionalDomain;
    private javax.swing.JLabel lblZiField;
    private javax.swing.JLabel lblZiGraficObject;
    private javax.swing.JTree managerTree;
    private javax.swing.JMenuBar mnbMainMenu;
    private javax.swing.JPanel pnlDomainProperties;
    private javax.swing.JPanel pnlFieldProperties;
    private javax.swing.JPanel pnlGraphicObjectProperties;
    private javax.swing.JPanel pnlSourceProperties;
    private javax.swing.JProgressBar progressBar;
    private javax.swing.JRadioButton rdHorizontalDisplay;
    private javax.swing.JRadioButton rdMultipleDisplay;
    private javax.swing.JRadioButton rdVerticalDisplay;
    private javax.swing.JRadioButton rdWholeDisplay;
    private javax.swing.JScrollPane scrlPaneVisualizator;
    private javax.swing.JScrollPane scrlPanelManager;
    private javax.swing.JSplitPane splLeftSplitPane;
    private javax.swing.JSplitPane splWholeSplitPane;
    private javax.swing.JTabbedPane tbbSetup;
    private javax.swing.JTable tblMaterials;
    private javax.swing.JToolBar tbrMainTools;
    private javax.swing.JTextField txtFrequencyValue;
    private javax.swing.JTextField txtPmlTickness;
    private javax.swing.JTextField txtResolution;
    private javax.swing.JTextField txtSourceEndTime;
    private javax.swing.JTextField txtSourceStartTime;
    private javax.swing.JTextField txtSourceWidth;
    private javax.swing.JTextField txtXExtension;
    private javax.swing.JTextField txtXSourcePosition;
    private javax.swing.JTextField txtXfComputacionalDomain;
    private javax.swing.JTextField txtXfField;
    private javax.swing.JTextField txtXfGraficObject;
    private javax.swing.JTextField txtXiComputacionalDomain;
    private javax.swing.JTextField txtXiField;
    private javax.swing.JTextField txtXiGraficObject;
    private javax.swing.JTextField txtYExtension;
    private javax.swing.JTextField txtYSourcePosition;
    private javax.swing.JTextField txtYfComputacionalDomain;
    private javax.swing.JTextField txtYfField;
    private javax.swing.JTextField txtYfGraficObject;
    private javax.swing.JTextField txtYiComputacionalDomain;
    private javax.swing.JTextField txtYiField;
    private javax.swing.JTextField txtYiGraficObject;
    private javax.swing.JTextField txtZExtension;
    private javax.swing.JTextField txtZSourcePosition;
    private javax.swing.JTextField txtZfComputacionalDomain;
    private javax.swing.JTextField txtZfField;
    private javax.swing.JTextField txtZfGraficObject;
    private javax.swing.JTextField txtZiComputacionalDomain;
    private javax.swing.JTextField txtZiField;
    private javax.swing.JTextField txtZiGraficObject;
    private javax.swing.JPanel viewPanel;
    // End of variables declaration//GEN-END:variables
    // </editor-fold>
    
    private class BackgroundProcessingTask extends SwingWorker<Object, Object> {
        
        @Override
        protected Object doInBackground() throws Exception 
        {
            SembrProcessing processing = new SembrProcessing(getSembrPath());
            processing.run();
            
            return null;
        }
        
        @Override
        protected void done()
        {
            progressBar.setIndeterminate(false);
            lblStatus.setText("Simulação Efetuada");
            getProjectSettings().setIsPostProcessing(true);
            new XmlFileWriter(getProjectSettings().getProjectDirectory()).save(projectSettings);
        }        
    }    
}
